(* Content-type: application/mathematica *)

(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)

(* CreatedBy='Mathematica 6.0' *)

(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[       145,          7]
NotebookDataLength[    292496,       6429]
NotebookOptionsPosition[    289723,       6346]
NotebookOutlinePosition[    290142,       6362]
CellTagsIndexPosition[    290099,       6359]
WindowFrame->Normal*)

(* Beginning of Notebook Content *)
Notebook[{

Cell[CellGroupData[{
Cell["Compgen NG", "Title",
 CellChangeTimes->{{3.503892540088009*^9, 3.503892543240986*^9}}],

Cell["\<\
Component generator for generating C++ component models for the HOPSAN NG \
simulation package\
\>", "Text",
 CellChangeTimes->{{3.503892552528222*^9, 3.503892609063722*^9}}],

Cell[CellGroupData[{

Cell["To do", "Subsection",
 CellChangeTimes->{{3.5133950305429354`*^9, 3.513395039931895*^9}}],

Cell["\<\
delayParts\[CloseCurlyDoubleQuote]n\[CloseCurlyDoubleQuote] is assigned to \
all equations
\
\>", "Text",
 CellChangeTimes->{{3.513395051208082*^9, 3.5133951014869814`*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["Node Definitions", "Subsection",
 CellChangeTimes->{{3.47818946578125*^9, 3.478189477890625*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"HydraulicQnode", "[", 
    RowBox[{"n_", ",", "pressure_", ",", "comment_"}], "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeHydraulic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<Pressure\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<q\>\"", ",", "0.", ",", "double", ",", "\"\<m3/s\>\"", ",", 
         "\"\<Flow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
         "\"\<Temperature\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
         "\"\<HeatFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}]}], 
    "}"}]}], ";"}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503923817893375*^9, 3.50392381987775*^9}, {3.50393984684375*^9, 
   3.5039399063125*^9}, 3.504198625171875*^9, {3.5075376487714634`*^9, 
   3.50753765133293*^9}, 3.508397152421875*^9, {3.515611883625*^9, 
   3.515611906796875*^9}, 3.5156119681875*^9, {3.515677400578125*^9, 
   3.515677401984375*^9}, 3.51603292134375*^9, {3.51685977290625*^9, 
   3.5168597794375*^9}, {3.51688595525*^9, 3.51688595978125*^9}, 
   3.516895419921875*^9, 3.5685208682531977`*^9, 3.568520913888761*^9, 
   3.5721611228475695`*^9, {3.575622099373434*^9, 3.575622133975894*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"HydraulicCnode", "[", 
    RowBox[{"n_", ",", "pressure_", ",", "comment_"}], "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeHydraulic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<Pressure\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<q\>\"", ",", "0.", ",", "double", ",", "\"\<m3/s\>\"", ",", 
         "\"\<Flow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
         "\"\<Temperature\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
         "\"\<HeatFlow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}]}], 
    "}"}]}], ";"}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503923817893375*^9, 3.50392381987775*^9}, {3.50393984684375*^9, 
   3.5039399063125*^9}, 3.504198625171875*^9, {3.50427115373594*^9, 
   3.50427116670469*^9}, 3.5075376638903646`*^9, 3.508397154390625*^9, {
   3.515677282796875*^9, 3.515677294640625*^9}, {3.51567740240625*^9, 
   3.515677403578125*^9}, 3.516032922171875*^9, {3.5168190990625*^9, 
   3.516819111109375*^9}, {3.516859695921875*^9, 3.51685969740625*^9}, {
   3.516859765*^9, 3.5168597703125*^9}, {3.516895333984375*^9, 
   3.516895336859375*^9}, 3.51689542478125*^9, {3.5685205313753757`*^9, 
   3.5685206003644114`*^9}, {3.5685206562600007`*^9, 3.568520672166591*^9}, {
   3.5685207138317575`*^9, 3.568520716320006*^9}, {3.5685207465130253`*^9, 
   3.5685207602674007`*^9}, 3.572161119391224*^9, 3.5756221471352096`*^9, {
   3.575622225218017*^9, 3.575622241265622*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"PneumaticQnode", "[", 
   RowBox[{"n_", ",", "pressure_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodePneumatic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<Pressure\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<qm\>\"", ",", "0.", ",", "double", ",", "\"\<kg/s\>\"", ",", 
        "\"\<MassFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
        "\"\<Temperature\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
        "\"\<EnergyFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}]}], 
   "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.445856965612655*^9, 3.4458569678157663`*^9}, {
   3.445857089236864*^9, 3.4458572835481205`*^9}, {3.4458573918130527`*^9, 
   3.4458574212659893`*^9}, {3.516292784578125*^9, 3.516292848328125*^9}, {
   3.516292878625*^9, 3.516292886546875*^9}, {3.5168191880625*^9, 
   3.51681931203125*^9}, {3.516859782203125*^9, 3.516859792015625*^9}, {
   3.51688588728125*^9, 3.51688589009375*^9}, 3.516885920671875*^9, 
   3.516895298890625*^9, 3.51689542540625*^9, {3.568449960509503*^9, 
   3.5684499619776497`*^9}, {3.5684500726307592`*^9, 3.5684500728358*^9}, {
   3.568520695186893*^9, 3.568520704786853*^9}, 3.572161113099595*^9, {
   3.57562215824132*^9, 3.5756221913266287`*^9}, {3.575622260099505*^9, 
   3.5756222684463396`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"PneumaticRnode", "[", 
   RowBox[{"n_", ",", "pressure_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Qport\>\"", ",", "\"\<ReadPort\>\"", ",", 
    "\"\<NodePneumatic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<Pressure\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<qm\>\"", ",", "0.", ",", "double", ",", "\"\<kg/s\>\"", ",", 
        "\"\<MassFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
        "\"\<Temperature\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
        "\"\<EnergyFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}]}], 
   "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.445856965612655*^9, 3.4458569678157663`*^9}, {
   3.445857089236864*^9, 3.4458572835481205`*^9}, {3.4458573918130527`*^9, 
   3.4458574212659893`*^9}, {3.516292784578125*^9, 3.516292848328125*^9}, {
   3.516292878625*^9, 3.516292886546875*^9}, {3.5168191880625*^9, 
   3.51681931203125*^9}, {3.516859782203125*^9, 3.516859792015625*^9}, {
   3.51688588728125*^9, 3.51688589009375*^9}, 3.516885920671875*^9, 
   3.516895298890625*^9, 3.51689542540625*^9, {3.568449960509503*^9, 
   3.5684499619776497`*^9}, {3.5684500726307592`*^9, 3.5684500728358*^9}, {
   3.568520695186893*^9, 3.568520704786853*^9}, 3.572161113099595*^9, {
   3.57217782226622*^9, 3.5721778326632595`*^9}, 3.575622212154711*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"PneumaticCnode", "[", 
   RowBox[{"n_", ",", "pressure_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodePneumatic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<Pressure\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<qm\>\"", ",", "0.", ",", "double", ",", "\"\<kg/s\>\"", ",", 
        "\"\<MassFlow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
        "\"\<Temperature\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
        "\"\<EnergyFlow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}]}], 
   "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.445856965612655*^9, 3.4458569678157663`*^9}, {
   3.445857089236864*^9, 3.4458572835481205`*^9}, {3.4458573918130527`*^9, 
   3.4458573924224234`*^9}, {3.445857425609711*^9, 3.4458574276096983`*^9}, 
   3.5162929209375*^9, 3.516699471185638*^9, {3.51681933209375*^9, 
   3.516819349890625*^9}, {3.51685979440625*^9, 3.5168598035*^9}, {
   3.516885896484375*^9, 3.51688592446875*^9}, 3.516895345390625*^9, 
   3.5168954260625*^9, {3.568449969132365*^9, 3.568450068790992*^9}, {
   3.568520805696943*^9, 3.568520836020975*^9}, {3.572161092083493*^9, 
   3.5721611031936045`*^9}, {3.5756222764601407`*^9, 3.5756223038678813`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicQnode", "[", 
    RowBox[{"n_", ",", "position_", ",", "comment_"}], "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<f\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<Force\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<x\>\"", ",", "position", ",", "double", ",", "\"\<m\>\"", ",", 
         "\"\<Position\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<v\>\"", ",", "0.", ",", "double", ",", "\"\<m/s\>\"", ",", 
         "\"\<Velocity\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<N/m/s\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqMass\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<EquivalentMass\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}]}], 
    "}"}]}], ";"}]], "Input",
 CellChangeTimes->{
  3.5042387760416336`*^9, 3.507537666639256*^9, 3.50839715696875*^9, 
   3.515677296796875*^9, {3.5156773318125*^9, 3.5156773405*^9}, {
   3.515677403921875*^9, 3.515677404875*^9}, {3.516859805359375*^9, 
   3.516859814546875*^9}, {3.516859879015625*^9, 3.51685988103125*^9}, 
   3.51689530265625*^9, 3.5168954270625*^9, 3.519442202046875*^9, 
   3.52178198671875*^9, {3.525628565109375*^9, 3.52562856559375*^9}, {
   3.575622313891884*^9, 3.575622342276722*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicCnode", "[", 
    RowBox[{"n_", ",", "position_", ",", "comment_"}], "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<f\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<Force\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<x\>\"", ",", "position", ",", "double", ",", "\"\<m\>\"", ",", 
         "\"\<Position\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<v\>\"", ",", "0.", ",", "double", ",", "\"\<m/s\>\"", ",", 
         "\"\<Velocity\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<N/m/s\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqMass\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<EquivalentMass\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}]}], 
    "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.516859858640625*^9, 3.51685987465625*^9}, 
   3.51689535709375*^9, 3.5168954278125*^9, {3.5193180836875*^9, 
   3.519318104046875*^9}, {3.519442160390625*^9, 3.519442195625*^9}, {
   3.5756223972002134`*^9, 3.5756224135208454`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicRotQnode", "[", 
    RowBox[{"n_", ",", "position_", ",", "speed_", ",", "comment_"}], "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanicRotational\>\"", ",", "comment", ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<tor\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<Torque\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<theta\>\"", ",", "position", ",", "double", ",", "\"\<rad\>\"", 
         ",", "\"\<Angle\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<w\>\"", ",", "0.", ",", "speed", ",", "\"\<rad/s\>\"", ",", 
         "\"\<AngularVelocity\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqInertia\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", 
         ",", "\"\<EquivalentInertia\>\"", ",", "\"\<out\>\""}], "}"}]}], 
      "}"}]}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{
  3.5042387760416336`*^9, 3.507537666639256*^9, 3.50839715696875*^9, {
   3.512925394421875*^9, 3.5129254975*^9}, {3.513235434609375*^9, 
   3.51323543625*^9}, 3.515677302140625*^9, {3.515677343546875*^9, 
   3.515677374703125*^9}, {3.515677405109375*^9, 3.515677406625*^9}, {
   3.515726256988942*^9, 3.5157262683887405`*^9}, {3.5157518725749655`*^9, 
   3.5157518789655495`*^9}, {3.51575314977884*^9, 3.515753163575715*^9}, 
   3.51575321837259*^9, 3.51603292303125*^9, {3.516859817921875*^9, 
   3.516859827921875*^9}, 3.516895305921875*^9, 3.516895428609375*^9, {
   3.519318053765625*^9, 3.519318064875*^9}, {3.51944204340625*^9, 
   3.5194421116875*^9}, {3.519442183609375*^9, 3.519442183703125*^9}, {
   3.5756224242659197`*^9, 3.5756224720446973`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicRotCnode", "[", 
    RowBox[{"n_", ",", "position_", ",", "speed_", ",", "comment_"}], "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanicRotational\>\"", ",", "comment", ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<tor\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<Torque\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<theta\>\"", ",", "position", ",", "double", ",", "\"\<m\>\"", 
         ",", "\"\<Angle\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<w\>\"", ",", "speed", ",", "double", ",", "\"\<rad/s\>\"", ",", 
         "\"\<AngularVelocity\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqInertia\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", 
         ",", "\"\<EquivalentInertia\>\"", ",", "\"\<in\>\""}], "}"}]}], 
      "}"}]}], "}"}]}], ";"}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.5041736725*^9, 3.50417374659375*^9}, {
   3.504198381578125*^9, 3.50419838565625*^9}, {3.50419845028125*^9, 
   3.504198460140625*^9}, 3.504198494421875*^9, {3.5041986015625*^9, 
   3.504198664390625*^9}, 3.5042387749644194`*^9, 3.507537671574765*^9, 
   3.51567730490625*^9, {3.515677348625*^9, 3.5156773694375*^9}, {
   3.515677407140625*^9, 3.515677408203125*^9}, {3.5157519070434947`*^9, 
   3.515751912527835*^9}, {3.51575317256009*^9, 3.51575317574759*^9}, {
   3.515753209606965*^9, 3.515753212919465*^9}, 3.51603296146875*^9, {
   3.5168598334375*^9, 3.516859849484375*^9}, 3.516859883796875*^9, 
   3.516895359671875*^9, 3.516895429703125*^9, {3.51931811525*^9, 
   3.51931811925*^9}, 3.5193182861875*^9, {3.51944197015625*^9, 
   3.519442021828125*^9}, {3.519442126875*^9, 3.51944213209375*^9}, {
   3.519442185578125*^9, 3.51944218571875*^9}, {3.519442750875*^9, 
   3.51944278278125*^9}, {3.575622457645258*^9, 3.5756224751240053`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ElectricQnode", "[", 
   RowBox[{"n_", ",", "voltage_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodeElectric\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<u\>\"", ",", "voltage", ",", "double", ",", "\"\<Volt\>\"", ",", 
        "\"\<Voltage\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<i\>\"", ",", "0.", ",", "double", ",", "\"\<A\>\"", ",", 
        "\"\<Current\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<V\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<V/A\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}]}], 
   "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.50419839734375*^9, 3.504198417484375*^9}, {
   3.50419847425*^9, 3.504198501296875*^9}, {3.504198560375*^9, 
   3.504198574984375*^9}, 3.504238772404084*^9, 3.5075376765571303`*^9, 
   3.5154964214098053`*^9, 3.5156773114375*^9, {3.51567735975*^9, 
   3.51567736121875*^9}, {3.515677409984375*^9, 3.5156774108125*^9}, 
   3.515725863124125*^9, {3.516032656046875*^9, 3.516032671375*^9}, 
   3.516032924921875*^9, {3.5168193873125*^9, 3.51681939884375*^9}, 
   3.5168953250625*^9, 3.51689543046875*^9, {3.575622491690662*^9, 
   3.5756225041699095`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ElectricCnode", "[", 
   RowBox[{"n_", ",", "voltage_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodeElectric\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<u\>\"", ",", "voltage", ",", "double", ",", "\"\<Volt\>\"", ",", 
        "\"\<Voltage\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<i\>\"", ",", "0.", ",", "double", ",", "\"\<A\>\"", ",", 
        "\"\<Current\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<V\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<V/A\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}]}], 
   "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.504198347796875*^9, 3.5041983611875*^9}, {
   3.504198468484375*^9, 3.504198489953125*^9}, {3.50419852853125*^9, 
   3.50419855559375*^9}, 3.5042387738403697`*^9, 3.507537674807836*^9, 
   3.515677308203125*^9, {3.515677352375*^9, 3.515677367109375*^9}, {
   3.515677408703125*^9, 3.51567740946875*^9}, {3.515725819421*^9, 
   3.5157258376085*^9}, 3.51603268178125*^9, 3.516032923921875*^9, 
   3.516895364953125*^9, 3.516895431296875*^9, {3.575622510553548*^9, 
   3.575622518566349*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"SignalInNode", "[", 
   RowBox[{"u_", ",", "value_", ",", "unit_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "u", ",", "\"\<InPort\>\"", ",", "\"\<ReadPort\>\"", ",", 
    "\"\<NodeSignal\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{"{", 
      RowBox[{
      "\"\<\>\"", ",", "value", ",", "double", ",", "unit", ",", 
       "\"\<Value\>\"", ",", "\"\<in\>\""}], "}"}], "}"}]}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503922218796197*^9, 3.503922220249313*^9}, {3.503922262264669*^9, 
   3.5039222628427906`*^9}, {3.5039223133112173`*^9, 3.503922334904829*^9}, {
   3.503922400888987*^9, 3.503922415513987*^9}, {3.50392254357582*^9, 
   3.503922546544513*^9}, {3.503923548410435*^9, 3.5039235511916676`*^9}, {
   3.503923771815875*^9, 3.503923810534*^9}, {3.503923907611073*^9, 
   3.503923918642182*^9}, {3.5039239502199025`*^9, 3.503923987141305*^9}, {
   3.50392486368575*^9, 3.50392487231075*^9}, {3.5039294179375*^9, 
   3.503929443890625*^9}, {3.50393871465625*^9, 3.503938725609375*^9}, {
   3.503939030328125*^9, 3.50393904*^9}, {3.503939386125*^9, 
   3.503939386734375*^9}, {3.5039399246875*^9, 3.503939926203125*^9}, 
   3.503941358109375*^9, {3.50394173640625*^9, 3.503941741015625*^9}, 
   3.503941839875*^9, {3.506006476484375*^9, 3.50600647675*^9}, {
   3.507537679729657*^9, 3.5075377002968946`*^9}, 3.515677018328125*^9, 
   3.515677262515625*^9, 3.51567741165625*^9, {3.515677551375*^9, 
   3.5156775595*^9}, {3.516895371296875*^9, 3.516895379140625*^9}, {
   3.5183292386909294`*^9, 3.518329242831501*^9}, {3.575622655049996*^9, 
   3.5756226560330944`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"SignalOutNode", "[", 
   RowBox[{"y_", ",", "value_", ",", "unit_", ",", "comment_"}], "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "y", ",", "\"\<OutPort\>\"", ",", "\"\<WritePort\>\"", ",", 
    "\"\<NodeSignal\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{"{", 
      RowBox[{
      "\"\<\>\"", ",", "value", ",", "double", ",", "unit", ",", 
       "\"\<Value\>\"", ",", "\"\<out\>\""}], "}"}], "}"}]}], 
   "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503922218796197*^9, 3.503922220249313*^9}, {3.503922262264669*^9, 
   3.5039222628427906`*^9}, {3.5039223133112173`*^9, 3.503922334904829*^9}, {
   3.503922400888987*^9, 3.503922415513987*^9}, {3.50392254357582*^9, 
   3.503922546544513*^9}, {3.503923548410435*^9, 3.5039235511916676`*^9}, {
   3.503923771815875*^9, 3.503923810534*^9}, {3.503923907611073*^9, 
   3.503923918642182*^9}, {3.5039239502199025`*^9, 3.503923987141305*^9}, {
   3.50392486368575*^9, 3.50392487231075*^9}, {3.5039294179375*^9, 
   3.503929443890625*^9}, {3.50393871465625*^9, 3.503938725609375*^9}, {
   3.503939030328125*^9, 3.50393904*^9}, {3.503939386125*^9, 
   3.503939386734375*^9}, {3.5039399246875*^9, 3.503939926203125*^9}, 
   3.503941358109375*^9, {3.503941723203125*^9, 3.503941745640625*^9}, {
   3.503941843890625*^9, 3.503941845125*^9}, {3.504107551578125*^9, 
   3.50410755221875*^9}, {3.507537681761375*^9, 3.5075377061419907`*^9}, {
   3.507549841498027*^9, 3.5075498419042664`*^9}, 3.515677023671875*^9, {
   3.515677267625*^9, 3.515677268171875*^9}, 3.515677412203125*^9, {
   3.5157547647855*^9, 3.515754765019875*^9}, {3.51689538409375*^9, 
   3.5168953910625*^9}, {3.518329233144125*^9, 3.518329235284723*^9}, {
   3.575622659202411*^9, 3.575622660081499*^9}}],

Cell["\<\
c1e  = onPositive[p1]c1;\tZc1e = onPositive[p1]Zc1;
c2e  = onPositive[p2]c2;\tZc2e = onPositive[p2]Zc2;
c3e  = onPositive[p3]c3;\tZc3e = onPositive[p3]Zc3;\t
c4e  = onPositive[p4]c4;\tZc4e = onPositive[p4]Zc4;\t
c5e  = onPositive[p5]c5;\tZc5e = onPositive[p5]Zc5;\t
c6e  = onPositive[p6]c6;\tZc6e = onPositive[p6]Zc6;\t
c7e  = onPositive[p7]c7;\tZc7e = onPositive[p7]Zc7;\t
c8e  = onPositive[p8]c8;\tZc8e = onPositive[p8]Zc8;\t
c9e  = onPositive[p9]c9;\tZc9e = onPositive[p9]Zc9;

cpe  = onPositive[pp]cp;\tZcpe = onPositive[pp]Zcp;
cte  = onPositive[pt]ct;\tZcte = onPositive[pt]Zct;
cae  = onPositive[pa]ca;\tZcae = onPositive[pa]Zca;
cbe  = onPositive[pb]cb;\tZcbe = onPositive[pb]Zcb;\
\>", "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.5058230242546153`*^9, 3.5058230333948307`*^9}, {
  3.515752936778079*^9, 3.515752984887762*^9}, {3.5160329395625*^9, 
  3.516032952109375*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["ALternative: Port Definitions", "Subsection",
 CellChangeTimes->{{3.47818946578125*^9, 3.478189477890625*^9}, {
  3.535541474515625*^9, 3.5355414838125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"HydraulicQport", "[", 
    RowBox[{"n_", ",", "pressure_", ",", "comment_", ",", "portPosition_"}], 
    "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeHydraulic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<Pressure\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<q\>\"", ",", "0.", ",", "double", ",", "\"\<m3/s\>\"", ",", 
         "\"\<Flow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
         "\"\<Temperature\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
         "\"\<HeatFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}], ",", 
     "portPosition"}], "}"}]}], ";"}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503923817893375*^9, 3.50392381987775*^9}, {3.50393984684375*^9, 
   3.5039399063125*^9}, 3.504198625171875*^9, {3.5075376487714634`*^9, 
   3.50753765133293*^9}, 3.508397152421875*^9, {3.515611883625*^9, 
   3.515611906796875*^9}, 3.5156119681875*^9, {3.515677400578125*^9, 
   3.515677401984375*^9}, 3.51603292134375*^9, {3.51685977290625*^9, 
   3.5168597794375*^9}, {3.51688595525*^9, 3.51688595978125*^9}, 
   3.516895419921875*^9, 3.5685208682531977`*^9, 3.568520913888761*^9, 
   3.5721611228475695`*^9, {3.575622099373434*^9, 3.575622133975894*^9}, {
   3.5773595923948708`*^9, 3.577359611018936*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"HydraulicCport", "[", 
    RowBox[{"n_", ",", "pressure_", ",", "comment_", ",", "portPosition_"}], 
    "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeHydraulic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<Pressure\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<q\>\"", ",", "0.", ",", "double", ",", "\"\<m3/s\>\"", ",", 
         "\"\<Flow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
         "\"\<Temperature\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
         "\"\<HeatFlow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}], ",", 
     "portPosition"}], "}"}]}], ";"}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503923817893375*^9, 3.50392381987775*^9}, {3.50393984684375*^9, 
   3.5039399063125*^9}, 3.504198625171875*^9, {3.50427115373594*^9, 
   3.50427116670469*^9}, 3.5075376638903646`*^9, 3.508397154390625*^9, {
   3.515677282796875*^9, 3.515677294640625*^9}, {3.51567740240625*^9, 
   3.515677403578125*^9}, 3.516032922171875*^9, {3.5168190990625*^9, 
   3.516819111109375*^9}, {3.516859695921875*^9, 3.51685969740625*^9}, {
   3.516859765*^9, 3.5168597703125*^9}, {3.516895333984375*^9, 
   3.516895336859375*^9}, 3.51689542478125*^9, {3.5685205313753757`*^9, 
   3.5685206003644114`*^9}, {3.5685206562600007`*^9, 3.568520672166591*^9}, {
   3.5685207138317575`*^9, 3.568520716320006*^9}, {3.5685207465130253`*^9, 
   3.5685207602674007`*^9}, 3.572161119391224*^9, 3.5756221471352096`*^9, {
   3.575622225218017*^9, 3.575622241265622*^9}, {3.5773596402386074`*^9, 
   3.577359650738208*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"PneumaticQnode", "[", 
   RowBox[{"n_", ",", "pressure_", ",", "comment_", ",", "portPosition_"}], 
   "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodePneumatic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<Pressure\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<qm\>\"", ",", "0.", ",", "double", ",", "\"\<kg/s\>\"", ",", 
        "\"\<MassFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
        "\"\<Temperature\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
        "\"\<EnergyFlow\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}], ",", 
    "portPosition"}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.445856965612655*^9, 3.4458569678157663`*^9}, {
   3.445857089236864*^9, 3.4458572835481205`*^9}, {3.4458573918130527`*^9, 
   3.4458574212659893`*^9}, {3.516292784578125*^9, 3.516292848328125*^9}, {
   3.516292878625*^9, 3.516292886546875*^9}, {3.5168191880625*^9, 
   3.51681931203125*^9}, {3.516859782203125*^9, 3.516859792015625*^9}, {
   3.51688588728125*^9, 3.51688589009375*^9}, 3.516885920671875*^9, 
   3.516895298890625*^9, 3.51689542540625*^9, {3.568449960509503*^9, 
   3.5684499619776497`*^9}, {3.5684500726307592`*^9, 3.5684500728358*^9}, {
   3.568520695186893*^9, 3.568520704786853*^9}, 3.572161113099595*^9, {
   3.57562215824132*^9, 3.5756221913266287`*^9}, {3.575622260099505*^9, 
   3.5756222684463396`*^9}, {3.577359678871817*^9, 3.577359684028112*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"PneumaticCport", "[", 
   RowBox[{"n_", ",", "pressure_", ",", "comment_", ",", "portPosition_"}], 
   "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodePneumatic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<p\>\"", ",", "pressure", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<Pressure\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<qm\>\"", ",", "0.", ",", "double", ",", "\"\<kg/s\>\"", ",", 
        "\"\<MassFlow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<T\>\"", ",", "293.", ",", "double", ",", "\"\<K\>\"", ",", 
        "\"\<Temperature\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<dE\>\"", ",", "0.", ",", "double", ",", "\"\<J/s\>\"", ",", 
        "\"\<EnergyFlow\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Pa\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<m5/s/N\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}], ",", 
    "portPosition"}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.445856965612655*^9, 3.4458569678157663`*^9}, {
   3.445857089236864*^9, 3.4458572835481205`*^9}, {3.4458573918130527`*^9, 
   3.4458573924224234`*^9}, {3.445857425609711*^9, 3.4458574276096983`*^9}, 
   3.5162929209375*^9, 3.516699471185638*^9, {3.51681933209375*^9, 
   3.516819349890625*^9}, {3.51685979440625*^9, 3.5168598035*^9}, {
   3.516885896484375*^9, 3.51688592446875*^9}, 3.516895345390625*^9, 
   3.5168954260625*^9, {3.568449969132365*^9, 3.568450068790992*^9}, {
   3.568520805696943*^9, 3.568520836020975*^9}, {3.572161092083493*^9, 
   3.5721611031936045`*^9}, {3.5756222764601407`*^9, 
   3.5756223038678813`*^9}, {3.5773597362170973`*^9, 3.577359741881421*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicQport", "[", 
    RowBox[{"n_", ",", "position_", ",", "comment_", ",", "portPosition_"}], 
    "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<f\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<Force\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<x\>\"", ",", "position", ",", "double", ",", "\"\<m\>\"", ",", 
         "\"\<Position\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<v\>\"", ",", "0.", ",", "double", ",", "\"\<m/s\>\"", ",", 
         "\"\<Velocity\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<N/m/s\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqMass\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<EquivalentMass\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}], ",", 
     "portPosition"}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{
  3.5042387760416336`*^9, 3.507537666639256*^9, 3.50839715696875*^9, 
   3.515677296796875*^9, {3.5156773318125*^9, 3.5156773405*^9}, {
   3.515677403921875*^9, 3.515677404875*^9}, {3.516859805359375*^9, 
   3.516859814546875*^9}, {3.516859879015625*^9, 3.51685988103125*^9}, 
   3.51689530265625*^9, 3.5168954270625*^9, 3.519442202046875*^9, 
   3.52178198671875*^9, {3.525628565109375*^9, 3.52562856559375*^9}, {
   3.575622313891884*^9, 3.575622342276722*^9}, {3.577359793825392*^9, 
   3.5773598124554577`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicCport", "[", 
    RowBox[{"n_", ",", "position_", ",", "comment_", ",", "portPosition_"}], 
    "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanic\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<f\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<Force\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<x\>\"", ",", "position", ",", "double", ",", "\"\<m\>\"", ",", 
         "\"\<Position\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<v\>\"", ",", "0.", ",", "double", ",", "\"\<m/s\>\"", ",", 
         "\"\<Velocity\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<N\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<N/m/s\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqMass\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<EquivalentMass\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}], ",", 
     "portPosition"}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.516859858640625*^9, 3.51685987465625*^9}, 
   3.51689535709375*^9, 3.5168954278125*^9, {3.5193180836875*^9, 
   3.519318104046875*^9}, {3.519442160390625*^9, 3.519442195625*^9}, {
   3.5756223972002134`*^9, 3.5756224135208454`*^9}, {3.577359800820792*^9, 
   3.5773598134905167`*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicRotQport", "[", 
    RowBox[{"n_", ",", "position_", ",", "comment_", ",", "portPosition_"}], 
    "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanicRotational\>\"", ",", "comment", ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<tor\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<Torque\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<theta\>\"", ",", "position", ",", "double", ",", "\"\<rad\>\"", 
         ",", "\"\<Angle\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<w\>\"", ",", "0.", ",", "speed", ",", "\"\<rad/s\>\"", ",", 
         "\"\<AngularVelocity\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqInertia\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", 
         ",", "\"\<EquivalentInertia\>\"", ",", "\"\<out\>\""}], "}"}]}], 
      "}"}], ",", "portPosition"}], "}"}]}], ";"}]], "Input",
 CellChangeTimes->{
  3.5042387760416336`*^9, 3.507537666639256*^9, 3.50839715696875*^9, {
   3.512925394421875*^9, 3.5129254975*^9}, {3.513235434609375*^9, 
   3.51323543625*^9}, 3.515677302140625*^9, {3.515677343546875*^9, 
   3.515677374703125*^9}, {3.515677405109375*^9, 3.515677406625*^9}, {
   3.515726256988942*^9, 3.5157262683887405`*^9}, {3.5157518725749655`*^9, 
   3.5157518789655495`*^9}, {3.51575314977884*^9, 3.515753163575715*^9}, 
   3.51575321837259*^9, 3.51603292303125*^9, {3.516859817921875*^9, 
   3.516859827921875*^9}, 3.516895305921875*^9, 3.516895428609375*^9, {
   3.519318053765625*^9, 3.519318064875*^9}, {3.51944204340625*^9, 
   3.5194421116875*^9}, {3.519442183609375*^9, 3.519442183703125*^9}, {
   3.5756224242659197`*^9, 3.5756224720446973`*^9}, 3.577359849107554*^9, 
   3.5773598912169623`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"MechanicRotCport", "[", 
    RowBox[{"n_", ",", "position_", ",", "comment_", ",", "portPosition_"}], 
    "]"}], ":=", 
   RowBox[{"{", 
    RowBox[{
    "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
     "\"\<NodeMechanicRotational\>\"", ",", "comment", ",", 
     "\[IndentingNewLine]", 
     RowBox[{"{", 
      RowBox[{
       RowBox[{"{", 
        RowBox[{
        "\"\<tor\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<Torque\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<theta\>\"", ",", "position", ",", "double", ",", "\"\<m\>\"", 
         ",", "\"\<Angle\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<w\>\"", ",", "speed", ",", "double", ",", "\"\<rad/s\>\"", ",", 
         "\"\<AngularVelocity\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<Nm\>\"", ",", 
         "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", ",", 
         "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{"{", 
        RowBox[{
        "\"\<eqInertia\>\"", ",", "0.", ",", "double", ",", "\"\<Ns\>\"", 
         ",", "\"\<EquivalentInertia\>\"", ",", "\"\<in\>\""}], "}"}]}], 
      "}"}], ",", "portPosition"}], "}"}]}], ";"}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.5041736725*^9, 3.50417374659375*^9}, {
   3.504198381578125*^9, 3.50419838565625*^9}, {3.50419845028125*^9, 
   3.504198460140625*^9}, 3.504198494421875*^9, {3.5041986015625*^9, 
   3.504198664390625*^9}, 3.5042387749644194`*^9, 3.507537671574765*^9, 
   3.51567730490625*^9, {3.515677348625*^9, 3.5156773694375*^9}, {
   3.515677407140625*^9, 3.515677408203125*^9}, {3.5157519070434947`*^9, 
   3.515751912527835*^9}, {3.51575317256009*^9, 3.51575317574759*^9}, {
   3.515753209606965*^9, 3.515753212919465*^9}, 3.51603296146875*^9, {
   3.5168598334375*^9, 3.516859849484375*^9}, 3.516859883796875*^9, 
   3.516895359671875*^9, 3.516895429703125*^9, {3.51931811525*^9, 
   3.51931811925*^9}, 3.5193182861875*^9, {3.51944197015625*^9, 
   3.519442021828125*^9}, {3.519442126875*^9, 3.51944213209375*^9}, {
   3.519442185578125*^9, 3.51944218571875*^9}, {3.519442750875*^9, 
   3.51944278278125*^9}, {3.575622457645258*^9, 3.5756224751240053`*^9}, 
   3.5773598526327553`*^9, 3.5773598938611135`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ElectricQport", "[", 
   RowBox[{"n_", ",", "position_", ",", "comment_", ",", "portPosition_"}], 
   "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Qport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodeElectric\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<u\>\"", ",", "voltage", ",", "double", ",", "\"\<Volt\>\"", ",", 
        "\"\<Voltage\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<i\>\"", ",", "0.", ",", "double", ",", "\"\<A\>\"", ",", 
        "\"\<Current\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<V\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<V/A\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<in\>\""}], "}"}]}], "}"}], ",", 
    "portPosition"}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.50419839734375*^9, 3.504198417484375*^9}, {
   3.50419847425*^9, 3.504198501296875*^9}, {3.504198560375*^9, 
   3.504198574984375*^9}, 3.504238772404084*^9, 3.5075376765571303`*^9, 
   3.5154964214098053`*^9, 3.5156773114375*^9, {3.51567735975*^9, 
   3.51567736121875*^9}, {3.515677409984375*^9, 3.5156774108125*^9}, 
   3.515725863124125*^9, {3.516032656046875*^9, 3.516032671375*^9}, 
   3.516032924921875*^9, {3.5168193873125*^9, 3.51681939884375*^9}, 
   3.5168953250625*^9, 3.51689543046875*^9, {3.575622491690662*^9, 
   3.5756225041699095`*^9}, 3.577359857312023*^9, 3.5773598955302095`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ElectricCport", "[", 
   RowBox[{"n_", ",", "position_", ",", "comment_", ",", "portPosition_"}], 
   "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "n", ",", "\"\<Cport\>\"", ",", "\"\<PowerPort\>\"", ",", 
    "\"\<NodeElectric\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{
      RowBox[{"{", 
       RowBox[{
       "\"\<u\>\"", ",", "voltage", ",", "double", ",", "\"\<Volt\>\"", ",", 
        "\"\<Voltage\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<i\>\"", ",", "0.", ",", "double", ",", "\"\<A\>\"", ",", 
        "\"\<Current\>\"", ",", "\"\<in\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<c\>\"", ",", "0.", ",", "double", ",", "\"\<V\>\"", ",", 
        "\"\<WaveVariable\>\"", ",", "\"\<out\>\""}], "}"}], ",", 
      "\[IndentingNewLine]", 
      RowBox[{"{", 
       RowBox[{
       "\"\<Zc\>\"", ",", "0.", ",", "double", ",", "\"\<V/A\>\"", ",", 
        "\"\<CharImpedance\>\"", ",", "\"\<out\>\""}], "}"}]}], "}"}], ",", 
    "portPosition"}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.504198347796875*^9, 3.5041983611875*^9}, {
   3.504198468484375*^9, 3.504198489953125*^9}, {3.50419852853125*^9, 
   3.50419855559375*^9}, 3.5042387738403697`*^9, 3.507537674807836*^9, 
   3.515677308203125*^9, {3.515677352375*^9, 3.515677367109375*^9}, {
   3.515677408703125*^9, 3.51567740946875*^9}, {3.515725819421*^9, 
   3.5157258376085*^9}, 3.51603268178125*^9, 3.516032923921875*^9, 
   3.516895364953125*^9, 3.516895431296875*^9, {3.575622510553548*^9, 
   3.575622518566349*^9}, 3.577359862304309*^9, 3.5773598967522793`*^9}],

Cell[BoxData[
 RowBox[{
  RowBox[{"SignalInport", "[", 
   RowBox[{
   "u_", ",", "value_", ",", "unit_", ",", "comment_", ",", "portPosition_"}],
    "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "u", ",", "\"\<InPort\>\"", ",", "\"\<ReadPort\>\"", ",", 
    "\"\<NodeSignal\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{"{", 
      RowBox[{
      "\"\<\>\"", ",", "value", ",", "double", ",", "unit", ",", 
       "\"\<VALUE\>\"", ",", "\"\<in\>\""}], "}"}], "}"}], ",", 
    "portPosition"}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503922218796197*^9, 3.503922220249313*^9}, {3.503922262264669*^9, 
   3.5039222628427906`*^9}, {3.5039223133112173`*^9, 3.503922334904829*^9}, {
   3.503922400888987*^9, 3.503922415513987*^9}, {3.50392254357582*^9, 
   3.503922546544513*^9}, {3.503923548410435*^9, 3.5039235511916676`*^9}, {
   3.503923771815875*^9, 3.503923810534*^9}, {3.503923907611073*^9, 
   3.503923918642182*^9}, {3.5039239502199025`*^9, 3.503923987141305*^9}, {
   3.50392486368575*^9, 3.50392487231075*^9}, {3.5039294179375*^9, 
   3.503929443890625*^9}, {3.50393871465625*^9, 3.503938725609375*^9}, {
   3.503939030328125*^9, 3.50393904*^9}, {3.503939386125*^9, 
   3.503939386734375*^9}, {3.5039399246875*^9, 3.503939926203125*^9}, 
   3.503941358109375*^9, {3.50394173640625*^9, 3.503941741015625*^9}, 
   3.503941839875*^9, {3.506006476484375*^9, 3.50600647675*^9}, {
   3.507537679729657*^9, 3.5075377002968946`*^9}, 3.515677018328125*^9, 
   3.515677262515625*^9, 3.51567741165625*^9, {3.515677551375*^9, 
   3.5156775595*^9}, {3.516895371296875*^9, 3.516895379140625*^9}, {
   3.5183292386909294`*^9, 3.518329242831501*^9}, {3.535541533640625*^9, 
   3.53554153409375*^9}, 3.535541904140625*^9, 3.53554195753125*^9, {
   3.535555863578125*^9, 3.535555864*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"SignalOutport", "[", 
   RowBox[{
   "y_", ",", "value_", ",", "unit_", ",", "comment_", ",", "portPosition_"}],
    "]"}], ":=", 
  RowBox[{"{", 
   RowBox[{
   "y", ",", "\"\<OutPort\>\"", ",", "\"\<WritePort\>\"", ",", 
    "\"\<NodeSignal\>\"", ",", "comment", ",", "\[IndentingNewLine]", 
    RowBox[{"{", 
     RowBox[{"{", 
      RowBox[{
      "\"\<\>\"", ",", "value", ",", "double", ",", "unit", ",", 
       "\"\<VALUE\>\"", ",", "\"\<out\>\""}], "}"}], "}"}], ",", 
    "portPosition"}], "}"}]}]], "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.478081095734375*^9, 3.4780810995625*^9}, {
   3.478081174984375*^9, 3.478081199625*^9}, {3.47808123453125*^9, 
   3.478081257625*^9}, {3.4780837549375*^9, 3.478083810890625*^9}, {
   3.503922218796197*^9, 3.503922220249313*^9}, {3.503922262264669*^9, 
   3.5039222628427906`*^9}, {3.5039223133112173`*^9, 3.503922334904829*^9}, {
   3.503922400888987*^9, 3.503922415513987*^9}, {3.50392254357582*^9, 
   3.503922546544513*^9}, {3.503923548410435*^9, 3.5039235511916676`*^9}, {
   3.503923771815875*^9, 3.503923810534*^9}, {3.503923907611073*^9, 
   3.503923918642182*^9}, {3.5039239502199025`*^9, 3.503923987141305*^9}, {
   3.50392486368575*^9, 3.50392487231075*^9}, {3.5039294179375*^9, 
   3.503929443890625*^9}, {3.50393871465625*^9, 3.503938725609375*^9}, {
   3.503939030328125*^9, 3.50393904*^9}, {3.503939386125*^9, 
   3.503939386734375*^9}, {3.5039399246875*^9, 3.503939926203125*^9}, 
   3.503941358109375*^9, {3.503941723203125*^9, 3.503941745640625*^9}, {
   3.503941843890625*^9, 3.503941845125*^9}, {3.504107551578125*^9, 
   3.50410755221875*^9}, {3.507537681761375*^9, 3.5075377061419907`*^9}, {
   3.507549841498027*^9, 3.5075498419042664`*^9}, 3.515677023671875*^9, {
   3.515677267625*^9, 3.515677268171875*^9}, 3.515677412203125*^9, {
   3.5157547647855*^9, 3.515754765019875*^9}, {3.51689538409375*^9, 
   3.5168953910625*^9}, {3.518329233144125*^9, 3.518329235284723*^9}, {
   3.53554153459375*^9, 3.53554153509375*^9}, 3.535541904921875*^9, 
   3.535541958515625*^9, {3.535555867609375*^9, 3.535555868*^9}}],

Cell["\<\
c1e  = onPositive[p1]c1;\tZc1e = onPositive[p1]Zc1;
c2e  = onPositive[p2]c2;\tZc2e = onPositive[p2]Zc2;
c3e  = onPositive[p3]c3;\tZc3e = onPositive[p3]Zc3;\t
c4e  = onPositive[p4]c4;\tZc4e = onPositive[p4]Zc4;\t
c5e  = onPositive[p5]c5;\tZc5e = onPositive[p5]Zc5;\t
c6e  = onPositive[p6]c6;\tZc6e = onPositive[p6]Zc6;\t
c7e  = onPositive[p7]c7;\tZc7e = onPositive[p7]Zc7;\t
c8e  = onPositive[p8]c8;\tZc8e = onPositive[p8]Zc8;\t
c9e  = onPositive[p9]c9;\tZc9e = onPositive[p9]Zc9;

cpe  = onPositive[pp]cp;\tZcpe = onPositive[pp]Zcp;
cte  = onPositive[pt]ct;\tZcte = onPositive[pt]Zct;
cae  = onPositive[pa]ca;\tZcae = onPositive[pa]Zca;
cbe  = onPositive[pb]cb;\tZcbe = onPositive[pb]Zcb;\
\>", "Input",
 PageWidth->WindowWidth,
 CellChangeTimes->{{3.5058230242546153`*^9, 3.5058230333948307`*^9}, {
  3.515752936778079*^9, 3.515752984887762*^9}, {3.5160329395625*^9, 
  3.516032952109375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
  "AutoCodeAlert", "=", 
   "\"\<//==This code has been autogenerated using Compgen==\>\""}], 
  ";"}]], "Input",
 CellChangeTimes->{{3.572003647281807*^9, 3.5720037341899643`*^9}, 
   3.57200385053551*^9, {3.5721613808053627`*^9, 3.5721614125665383`*^9}}]
}, Open  ]],

Cell["Defining the derivative of some functions", "Subsection",
 CellChangeTimes->{{3.4786830746875*^9, 3.47868307540625*^9}}],

Cell[CellGroupData[{

Cell["Partial derivatives", "Subsection"],

Cell["\<\
Obtaining the jacobian matrix from a system G_ with respect to the vector y_ \
with n_elements.  \
\>", "SmallText"],

Cell["\<\
PartialDerivatives[G_,y_]:=
\t\tBlock[{a,i,j,n},
\t\t    n = Length[y];
\t\t\tJaco = Array[a,{n,n}];
\t\t\t\tFor[i = 1,i<n+1,i++,
\t\t\t\t\t\tFor[j = 1,j<n+1,j++,
\t\t\t\t\t\t\tJaco[[i,j]] = D[G[[i]],y[[j]] ]
\t\t\t\t\t\t ]
\t\t\t\t\t];
\t\t\tReturn[Jaco]]\
\>", "Input"],

Cell[BoxData[{
 RowBox[{
  RowBox[{
   RowBox[{"AddPrefix", "[", "variable_", "]"}], ":=", 
   RowBox[{"Block", "[", 
    RowBox[{
     RowBox[{"{", "}"}], ",", 
     RowBox[{"ToExpression", "[", 
      RowBox[{"StringJoin", "[", 
       RowBox[{
        RowBox[{"ToString", "[", "variable", "]"}], ",", "\"\<= m\>\"", ",", 
        RowBox[{"ToString", "[", "variable", "]"}]}], "]"}], "]"}]}], "]"}]}],
   ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"n", "=", 
   RowBox[{"Length", "[", "inputParameters", "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"inputParNames", "=", 
   RowBox[{"Array", "[", 
    RowBox[{"a", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"inputParNames0", "=", 
   RowBox[{"Array", "[", 
    RowBox[{"a", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"For", "[", 
   RowBox[{
    RowBox[{"i", "=", "1"}], ",", 
    RowBox[{"i", "<", 
     RowBox[{"n", "+", "1"}]}], ",", 
    RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      RowBox[{"inputParNames", "[", 
       RowBox[{"[", "i", "]"}], "]"}], "=", 
      RowBox[{"ToString", "[", 
       RowBox[{"inputParameters", "[", 
        RowBox[{"[", 
         RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"inputParNames0", "[", 
       RowBox[{"[", "i", "]"}], "]"}], "=", 
      RowBox[{"ToString", "[", 
       RowBox[{"inputParameters", "[", 
        RowBox[{"[", 
         RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}]}]}], 
   "\[IndentingNewLine]", "]"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"n", "=", 
   RowBox[{"Length", "[", "inputVariables", "]"}]}], 
  ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"inputVarNames", "=", 
   RowBox[{"Array", "[", 
    RowBox[{"a", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"inputVarNames0", "=", 
   RowBox[{"Array", "[", 
    RowBox[{"a", ",", "n"}], "]"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"For", "[", 
   RowBox[{
    RowBox[{"i", "=", "1"}], ",", 
    RowBox[{"i", "<", 
     RowBox[{"n", "+", "1"}]}], ",", 
    RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
      RowBox[{"inputVarNames", "[", 
       RowBox[{"[", "i", "]"}], "]"}], "=", 
      RowBox[{"ToString", "[", 
       RowBox[{"inputVariables", "[", 
        RowBox[{"[", 
         RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"inputVarNames0", "[", 
       RowBox[{"[", "i", "]"}], "]"}], "=", 
      RowBox[{"ToString", "[", 
       RowBox[{"inputVariables", "[", 
        RowBox[{"[", 
         RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}]}]}], 
   "\[IndentingNewLine]", "]"}], ";"}]}], "Input",
 CellChangeTimes->{{3.478171130046875*^9, 3.47817113325*^9}, {
   3.478171477859375*^9, 3.47817160796875*^9}, 3.478171643*^9, 
   3.4781716974375*^9, 3.478171735203125*^9, 3.478171778265625*^9, {
   3.478171821609375*^9, 3.4781718668125*^9}, {3.478180957953125*^9, 
   3.4781809595*^9}, 3.4781809955*^9, {3.478184383578125*^9, 
   3.47818438496875*^9}, {3.4785857624375*^9, 3.4785857870625*^9}, {
   3.478585864421875*^9, 3.478585888328125*^9}, {3.478586190609375*^9, 
   3.47858622915625*^9}, {3.4785862805625*^9, 3.478586285890625*^9}, 
   3.478599815890625*^9, {3.478614423984375*^9, 3.478614424515625*^9}, 
   3.478626807765625*^9, {3.4786268575625*^9, 3.478626858421875*^9}, {
   3.50399503753146*^9, 3.50399504634396*^9}, {3.503995293015835*^9, 
   3.50399530953146*^9}, {3.504121307890625*^9, 3.50412133596875*^9}, {
   3.519152590953125*^9, 3.519152635859375*^9}}],

Cell[BoxData[""], "Input",
 CellChangeTimes->{{3.51902682784375*^9, 3.51902682878125*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"ResetComponentVariables", "[", "]"}], ":=", 
  RowBox[{"Block", "[", 
   RowBox[{
    RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{
     "coauthor", "=", "\"\<**Not yet audited by a second person**\>\""}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"nodeConnections", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"portConnections", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"constantParameters", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"inputVariables", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"outputVariables", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"inputParameters", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"variableLimits", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"variableLowLimits", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"variable2Limits", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"initialExpressions", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"localExpressions", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"expressions", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"systemEquationsDa", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"systemEquationsDA", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"boundaryEquations", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"systemBoundaryEquations", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"systemVariables", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"timeDelays", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"timeDelayVariables", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"stepDelays", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"stepDelayVariables", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"s", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"tD1", "=", 
      RowBox[{"{", "}"}]}], ";"}]}], "]"}]}]], "Input",
 CellChangeTimes->{{3.50416099565625*^9, 3.504161071125*^9}, {
   3.504171390828125*^9, 3.504171394640625*^9}, {3.504326002487152*^9, 
   3.5043260030652885`*^9}, {3.516819831671875*^9, 3.5168199120625*^9}, {
   3.51682033584375*^9, 3.51682034846875*^9}, {3.516863481921875*^9, 
   3.516863483640625*^9}, {3.5170496952603617`*^9, 3.5170497271043158`*^9}, {
   3.51863041225*^9, 3.518630428453125*^9}, {3.522637581733566*^9, 
   3.5226376068136168`*^9}, {3.53554204075*^9, 3.53554206440625*^9}, {
   3.5371661272033715`*^9, 3.5371661299689965`*^9}, {3.5718603704173207`*^9, 
   3.571860372336124*^9}, {3.5719769870589294`*^9, 3.571976996325389*^9}, {
   3.578378271632408*^9, 3.578378278783123*^9}, {3.637640877817938*^9, 
   3.637640914410597*^9}, {3.6376410854997044`*^9, 3.637641093444499*^9}, 
   3.637641142928447*^9, {3.637641175924746*^9, 3.6376411794130945`*^9}, {
   3.6376416410232515`*^9, 3.6376416415983086`*^9}, {3.637642710922235*^9, 
   3.6376427232654696`*^9}, {3.637642756742817*^9, 3.637642758217964*^9}, {
   3.6376436617933125`*^9, 3.6376436655456877`*^9}, {3.6376436994030733`*^9, 
   3.637643757828057*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["Code for delay function", "Subsection",
 CellChangeTimes->{{3.50373151833272*^9, 3.503731522723317*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"tD1", "=", 
   RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"timeDelays", "=."}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"timeDelayVariables", "=."}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"tdv", "=", 
   RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"noDelay", "=", "0"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"DelayT", "[", 
   RowBox[{"y_", ",", "td_"}], "]"}], ":=", 
  RowBox[{"Block", "[", 
   RowBox[{
    RowBox[{"{", "}"}], ",", 
    RowBox[{
     RowBox[{"noDelay", "++"}], ";", "\[IndentingNewLine]", 
     RowBox[{"out", "=", 
      RowBox[{"StringJoin", "[", 
       RowBox[{"\"\<mDelay\>\"", ",", 
        RowBox[{"ToString", "[", "y", "]"}], ",", "\"\<.getIdx(\>\"", ",", 
        RowBox[{"ToString", "[", "y", "]"}], ",", "\"\<)\>\""}], "]"}]}], ";", 
     RowBox[{"timeDelays", "=", 
      RowBox[{"Append", "[", 
       RowBox[{"tD1", ",", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<mDelay\>\"", ",", 
            RowBox[{"ToString", "[", "y", "]"}]}], "]"}], ",", 
          RowBox[{"ToString", "[", "td", "]"}], ",", 
          RowBox[{"ToString", "[", "y", "]"}]}], "}"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"timeDelayVariables", "=", 
      RowBox[{"Append", "[", 
       RowBox[{"tdv", ",", 
        RowBox[{"{", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"ToString", "[", "y", "]"}], "]"}], "}"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"tD1", "=", "timeDelays"}], ";", "\[IndentingNewLine]", 
     RowBox[{"tdv", "=", "timeDelayVariables"}], ";", "\[IndentingNewLine]", 
     RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}]}], "Input",
 CellChangeTimes->{{3.478598579125*^9, 3.4785987288125*^9}, {
   3.4785987685625*^9, 3.478598800765625*^9}, {3.478598832859375*^9, 
   3.478598914015625*^9}, {3.478599005578125*^9, 3.47859901265625*^9}, {
   3.478599045796875*^9, 3.47859908009375*^9}, {3.478599112734375*^9, 
   3.47859911315625*^9}, {3.478599368859375*^9, 3.47859939203125*^9}, {
   3.478599453734375*^9, 3.478599454421875*^9}, {3.4785994880625*^9, 
   3.478599498*^9}, {3.47859953240625*^9, 3.47859953446875*^9}, {
   3.4785995960625*^9, 3.47859961209375*^9}, {3.4785996529375*^9, 
   3.478599673109375*^9}, 3.478599775515625*^9, {3.478600413171875*^9, 
   3.47860042378125*^9}, {3.47860073553125*^9, 3.47860077925*^9}, {
   3.4786064921875*^9, 3.4786065114375*^9}, {3.478606588265625*^9, 
   3.4786066415*^9}, {3.4786067225*^9, 3.478606738421875*^9}, {
   3.4786069211875*^9, 3.4786069254375*^9}, {3.478607022625*^9, 
   3.478607025625*^9}, 3.478607919859375*^9, {3.478608820171875*^9, 
   3.4786089048125*^9}, {3.478615896796875*^9, 3.4786158979375*^9}, {
   3.4786162555*^9, 3.47861626321875*^9}, {3.50432624347175*^9, 
   3.504326251503*^9}, {3.504326326003*^9, 3.504326328456125*^9}, 
   3.5043284122187233`*^9, 3.516687105430786*^9, {3.516687555774125*^9, 
   3.516687606961625*^9}, 3.516698395990458*^9, {3.5167055520236855`*^9, 
   3.516705576296544*^9}, {3.5167056090820847`*^9, 3.516705642477671*^9}, {
   3.516705702251652*^9, 3.5167057079228373`*^9}}],

Cell[BoxData[{
 RowBox[{
  RowBox[{"sD1", "=", 
   RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"sdv", "=", 
   RowBox[{"{", "}"}]}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"stepDelays", "=."}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"stepDelayVariables", "=."}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"noDelay", "=", "0"}], ";"}], "\[IndentingNewLine]", 
 RowBox[{
  RowBox[{"DelayStep", "[", 
   RowBox[{"y_", ",", "n_"}], "]"}], ":=", 
  RowBox[{"Block", "[", 
   RowBox[{
    RowBox[{"{", "}"}], ",", 
    RowBox[{
     RowBox[{"noDelay", "++"}], ";", "\[IndentingNewLine]", 
     RowBox[{"out", "=", 
      RowBox[{"StringJoin", "[", 
       RowBox[{"\"\<mDelay\>\"", ",", 
        RowBox[{"ToString", "[", "y", "]"}], ",", "\"\<.getIdx(\>\"", ",", 
        RowBox[{"ToString", "[", "y", "]"}], ",", "\"\<)\>\""}], "]"}]}], ";", 
     RowBox[{"stepDelays", "=", 
      RowBox[{"Append", "[", 
       RowBox[{"sD1", ",", 
        RowBox[{"{", 
         RowBox[{
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<mDelay\>\"", ",", 
            RowBox[{"ToString", "[", "y", "]"}]}], "]"}], ",", 
          RowBox[{"ToString", "[", "n", "]"}], ",", 
          RowBox[{"ToString", "[", "y", "]"}]}], "}"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"stepDelayVariables", "=", 
      RowBox[{"Append", "[", 
       RowBox[{"sdv", ",", 
        RowBox[{"{", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"ToString", "[", "y", "]"}], "]"}], "}"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"sD1", "=", "stepDelays"}], ";", "\[IndentingNewLine]", 
     RowBox[{"sdv", "=", "stepDelayVariables"}], ";", "\[IndentingNewLine]", 
     RowBox[{"Return", "[", "out", "]"}]}]}], "]"}]}]}], "Input",
 CellChangeTimes->{{3.478598579125*^9, 3.4785987288125*^9}, {
   3.4785987685625*^9, 3.478598800765625*^9}, {3.478598832859375*^9, 
   3.478598914015625*^9}, {3.478599005578125*^9, 3.47859901265625*^9}, {
   3.478599045796875*^9, 3.47859908009375*^9}, {3.478599112734375*^9, 
   3.47859911315625*^9}, {3.478599368859375*^9, 3.47859939203125*^9}, {
   3.478599453734375*^9, 3.478599454421875*^9}, {3.4785994880625*^9, 
   3.478599498*^9}, {3.47859953240625*^9, 3.47859953446875*^9}, {
   3.4785995960625*^9, 3.47859961209375*^9}, {3.4785996529375*^9, 
   3.478599673109375*^9}, 3.478599775515625*^9, {3.478600413171875*^9, 
   3.47860042378125*^9}, {3.47860073553125*^9, 3.47860077925*^9}, {
   3.4786064921875*^9, 3.4786065114375*^9}, {3.478606588265625*^9, 
   3.4786066415*^9}, {3.4786067225*^9, 3.478606738421875*^9}, {
   3.4786069211875*^9, 3.4786069254375*^9}, {3.478607022625*^9, 
   3.478607025625*^9}, 3.478607919859375*^9, {3.478608820171875*^9, 
   3.4786089048125*^9}, {3.478615896796875*^9, 3.4786158979375*^9}, {
   3.4786162555*^9, 3.47861626321875*^9}, {3.50432624347175*^9, 
   3.504326251503*^9}, {3.504326326003*^9, 3.504326328456125*^9}, 
   3.5043284122187233`*^9, {3.513158268453125*^9, 3.5131582749375*^9}, 
   3.5159028821590147`*^9, {3.5166871070245566`*^9, 3.516687139571848*^9}, {
   3.5166872046039305`*^9, 3.516687233244922*^9}, {3.516687341461625*^9, 
   3.516687432805375*^9}, 3.51668750235225*^9, {3.51668753353975*^9, 
   3.516687544555375*^9}, 3.516698381662333*^9, 3.516699544638763*^9, {
   3.516705627481973*^9, 3.516705648711288*^9}, {3.5167057147501316`*^9, 
   3.516705719858886*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{
   RowBox[{"WriteCode", "[", 
    RowBox[{"file_", ",", "text_"}], "]"}], ":=", 
   RowBox[{"Write", "[", 
    RowBox[{"file", ",", 
     RowBox[{"OutputForm", "[", "text", "]"}]}], "]"}]}], ";"}]], "Input",
 CellChangeTimes->{{3.478001325999318*^9, 3.4780014038831096`*^9}, 
   3.478001456602762*^9, {3.478173055109375*^9, 3.4781730575625*^9}, {
   3.478173170671875*^9, 3.478173172125*^9}, {3.47860764346875*^9, 
   3.478607644921875*^9}, {3.47860770296875*^9, 3.478607780484375*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"SetFilename", "[", 
   RowBox[{"domain_", ",", "displayName_"}], "]"}], ":=", 
  RowBox[{"Block", "[", 
   RowBox[{
    RowBox[{"{", "}"}], ",", 
    RowBox[{
     RowBox[{"componentName", " ", "=", " ", 
      RowBox[{"StringJoin", "[", 
       RowBox[{"domain", ",", "displayName"}], "]"}]}], ";", "\n", 
     RowBox[{"componentGroup", " ", "=", " ", 
      RowBox[{"StringJoin", "[", 
       RowBox[{"domain", ",", "\"\<Components\>\""}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"svgName", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.svg\>\""}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"XMLName", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.xml\>\""}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"file", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.hpp\>\""}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"filename", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.hpp\>\""}], "]"}], "]"}]}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.505978263515625*^9, 3.50597833025*^9}, {
  3.50597839178125*^9, 3.505978435125*^9}, {3.5194993843125*^9, 
  3.51949941509375*^9}, {3.51953787103125*^9, 3.519537883875*^9}, {
  3.519537937890625*^9, 3.519537950484375*^9}, {3.5195382124375*^9, 
  3.519538212796875*^9}, {3.53554089690625*^9, 3.535540902109375*^9}, {
  3.6114662979201965`*^9, 3.611466319801385*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"SetFilenames", "[", 
   RowBox[{"path_", ",", "domain_", ",", "displayName_"}], "]"}], ":=", 
  RowBox[{"Block", "[", 
   RowBox[{
    RowBox[{"{", "}"}], ",", 
    RowBox[{
     RowBox[{"componentName", " ", "=", " ", 
      RowBox[{"StringJoin", "[", 
       RowBox[{"domain", ",", "displayName"}], "]"}]}], ";", "\n", 
     RowBox[{"componentGroup", " ", "=", " ", 
      RowBox[{"StringJoin", "[", 
       RowBox[{"domain", ",", "\"\<Components\>\""}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"svgName", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.svg\>\""}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"XMLName", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.xml\>\""}], "]"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"ToString", "[", "path", "]"}], "\[Equal]", "\"\<path\>\""}], 
       ",", "\[IndentingNewLine]", 
       RowBox[{"file", " ", "=", " ", 
        RowBox[{"ToString", "[", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"componentName", ",", "\"\<.hpp\>\""}], "]"}], "]"}]}], ",",
        "\[IndentingNewLine]", 
       RowBox[{"file", " ", "=", " ", 
        RowBox[{"ToString", "[", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"path", ",", "componentName", ",", "\"\<.hpp\>\""}], "]"}], 
         "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"filename", " ", "=", " ", 
      RowBox[{"ToString", "[", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"componentName", ",", "\"\<.hpp\>\""}], "]"}], "]"}]}]}]}], 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.611469541825324*^9, 3.611469569676358*^9}, {
   3.611469607764167*^9, 3.611469634750865*^9}, {3.611469675311921*^9, 
   3.611469687058096*^9}, {3.6114697382602153`*^9, 3.6114697395323424`*^9}, 
   3.61147319662603*^9, {3.6114732338650303`*^9, 3.61147326156603*^9}, 
   3.611473644841976*^9, {3.611473678074299*^9, 3.6114736864201336`*^9}, {
   3.611473789107401*^9, 3.611473798239314*^9}, {3.6114746621276946`*^9, 
   3.6114746633058124`*^9}, {3.611474722346716*^9, 3.611474725526034*^9}}]
}, Open  ]],

Cell[CellGroupData[{

Cell["Write code on file", "Subsection",
 CellChangeTimes->{{3.50373151833272*^9, 3.503731522723317*^9}, {
  3.5037315886447697`*^9, 3.50373159323849*^9}}],

Cell[BoxData[
 RowBox[{
  RowBox[{"Compgen", "[", "file_", "]"}], ":=", 
  RowBox[{"Block", "[", 
   RowBox[{
    RowBox[{"{", "}"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", 
    "\[IndentingNewLine]", 
    RowBox[{
     RowBox[{"Open", "[", "file", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"AddPrefix", "[", "variable_", "]"}], ":=", 
      RowBox[{"Block", "[", 
       RowBox[{
        RowBox[{"{", "}"}], ",", 
        RowBox[{"ToExpression", "[", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
           RowBox[{"ToString", "[", "variable", "]"}], ",", "\"\<= m\>\"", 
           ",", 
           RowBox[{"ToString", "[", "variable", "]"}]}], "]"}], "]"}]}], 
       "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"inputParNames", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"inputParNames0", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"declaredVariables", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", 
        RowBox[{"{", "1000", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{
         RowBox[{"inputParNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputParameters", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"inputParNames0", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputParameters", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"inputVarNames", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"inputVarNames0", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{
         RowBox[{"inputVarNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputVariables", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"inputVarNames0", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputVariables", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{"Abs", "'"}], "[", "x_", "]"}], ":=", 
      RowBox[{"dxAbs", "[", "x", "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{"Sign", "'"}], "[", "x_", "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"Unprotect", "[", "Power", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{"Sign", "[", "x_", "]"}], "^", "2"}], ":=", "1"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"der", "[", "x_", "]"}], ":=", 
      RowBox[{"s", " ", "x"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{"Der", "[", "x_", "]"}], ":=", 
      RowBox[{"s", " ", "x"}]}], ";", 
     RowBox[{"dxli", "\[IndentingNewLine]", 
      RowBox[{"Protect", "[", "Power", "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", "1", "]"}], "[", "onPositive", "]"}], "[", 
       "x_", "]"}], ":=", "0"}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", "1", "]"}], "[", "onNegative", "]"}], "[", 
       "x_", "]"}], ":=", "0"}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0", ",", "0"}], "]"}], "[", "Hysteresis", "]"}], 
       "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", 
      RowBox[{"DxHysteresis", "[", 
       RowBox[{"x", ",", "xh", ",", "xd"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0", ",", "0"}], "]"}], "[", "sqrt", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", 
      RowBox[{"dxSqrt", "[", 
       RowBox[{"x", ",", "xh", ",", "xd"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0", ",", "0"}], "]"}], "[", "limit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", 
      RowBox[{"dxLimit", "[", 
       RowBox[{"x", ",", "xh", ",", "xd"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0"}], "]"}], "[", "lowLimit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_"}], "]"}], ":=", 
      RowBox[{"dxLowLimit", "[", 
       RowBox[{"x", ",", "xh"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "1", ",", "0"}], "]"}], "[", "limit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "0", ",", "1"}], "]"}], "[", "limit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0", ",", "0"}], "]"}], "[", "dxLimit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "1", ",", "0"}], "]"}], "[", "dxLimit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "0", ",", "1"}], "]"}], "[", "dxLimit", "]"}], "[", 
       RowBox[{"x_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0", ",", "0", ",", "0"}], "]"}], "[", "limit2", 
        "]"}], "[", 
       RowBox[{"x_", ",", "v_", ",", "xh_", ",", "xd_"}], "]"}], ":=", 
      RowBox[{"dxLimit2", "[", 
       RowBox[{"x", ",", "v", ",", "xh", ",", "xd"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "1", ",", "0", ",", "0"}], "]"}], "[", "limit2", 
        "]"}], "[", 
       RowBox[{"x_", ",", "v_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "0", ",", "1", ",", "0"}], "]"}], "[", "limit2", 
        "]"}], "[", 
       RowBox[{"x_", ",", "v_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "0", ",", "0", ",", "1"}], "]"}], "[", "limit2", 
        "]"}], "[", 
       RowBox[{"x_", ",", "v_", ",", "xh_", ",", "xd_"}], "]"}], ":=", "0"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", "1", "]"}], "[", "sign", "]"}], "[", "x_", 
       "]"}], ":=", "0"}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", "1", "]"}], "[", "asin", "]"}], "[", "x_", 
       "]"}], ":=", 
      FractionBox["1", 
       SqrtBox[
        RowBox[{"1", "-", 
         SuperscriptBox["x", "2"]}]]]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0"}], "]"}], "[", "SigSqrL", "]"}], "[", 
       RowBox[{"p_", ",", "p0_"}], "]"}], ":=", 
      RowBox[{"DxSigSqrL", "[", 
       RowBox[{"p", ",", "p0"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0"}], "]"}], "[", "signedSquareL", "]"}], "[", 
       RowBox[{"p_", ",", "p0_"}], "]"}], ":=", 
      RowBox[{"dxSignedSquareL", "[", 
       RowBox[{"p", ",", "p0"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"1", ",", "0", ",", "0"}], "]"}], "[", "ifPositive", "]"}], 
       "[", 
       RowBox[{"if_", ",", "then_", ",", "else_"}], "]"}], ":=", "0"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "1", ",", "0"}], "]"}], "[", "ifPositive", "]"}], 
       "[", 
       RowBox[{"if_", ",", "then_", ",", "else_"}], "]"}], ":=", 
      RowBox[{"dtifPositive", "[", 
       RowBox[{"if", ",", "then", ",", "else"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{
      RowBox[{
       RowBox[{
        RowBox[{"Derivative", "[", 
         RowBox[{"0", ",", "0", ",", "1"}], "]"}], "[", "ifPositive", "]"}], 
       "[", 
       RowBox[{"if_", ",", "then_", ",", "else_"}], "]"}], ":=", 
      RowBox[{"deifPositive", "[", 
       RowBox[{"if", ",", "then", ",", "else"}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"pi", "=", 
      RowBox[{"N", "[", 
       RowBox[{"Pi", ",", "6"}], "]"}]}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"noteBookFile", "=", 
      RowBox[{"StringJoin", "[", 
       RowBox[{
        RowBox[{"ToString", "[", 
         RowBox[{
          RowBox[{
           RowBox[{
            RowBox[{"NotebookInformation", "[", "]"}], "[", 
            RowBox[{"[", "1", "]"}], "]"}], "[", 
           RowBox[{"[", "2", "]"}], "]"}], "[", 
          RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\</\>\"", ",", 
        RowBox[{
         RowBox[{
          RowBox[{
           RowBox[{"NotebookInformation", "[", "]"}], "[", 
           RowBox[{"[", "1", "]"}], "]"}], "[", 
          RowBox[{"[", "2", "]"}], "]"}], "[", 
         RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<#ifndef \>\"", ",", 
         RowBox[{"ToString", "[", 
          RowBox[{"ToUpperCase", "[", "componentName", "]"}], "]"}], ",", 
         "\"\<_HPP_INCLUDED\>\""}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<#define \>\"", ",", 
         RowBox[{"ToString", "[", 
          RowBox[{"ToUpperCase", "[", "componentName", "]"}], "]"}], ",", 
         "\"\<_HPP_INCLUDED\>\""}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<#include <iostream>\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<#include <QDebug>\>\""}], "]"}], ";"}], 
      "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<#include \\\"ComponentEssentials.h\\\"\>\""}],
       "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<#include \\\"ComponentUtilities.h\\\"\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<#include \\\"math.h\\\"\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<//!\>\""}], "]"}], ";", "\[IndentingNewLine]",
      "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<//! @file \>\"", ",", 
         RowBox[{"ToString", "[", "filename", "]"}]}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<//! @author \>\"", ",", 
         RowBox[{"ToString", "[", "author", "]"}]}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<//  co-author/auditor \>\"", ",", 
         RowBox[{"ToString", "[", "coauthor", "]"}]}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<//! @date \>\"", ",", 
         RowBox[{"DateString", "[", "]"}]}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<//! @brief \>\"", ",", 
         RowBox[{"ToString", "[", "brief", "]"}]}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<//! @ingroup \>\"", ",", 
         RowBox[{"ToString", "[", "componentGroup", "]"}]}], "]"}]}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<//!\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", "\"\<//from \>\"", "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\</*\>\"", ",", 
         RowBox[{"ToString", "[", "noteBookFile", "]"}], ",", "\"\<*/\>\""}], 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<//Created \>\"", ",", 
       RowBox[{"DateString", "[", "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<using namespace hopsan;\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{
        "\"\<class \>\"", ",", "componentName", ",", "\"\< : public \>\"", 
         ",", "componentType"}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<{\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<private:\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"inputParNames", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"inputParNames0", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{
         RowBox[{"inputParNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputParameters", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"inputParNames0", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputParameters", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"inputVarNames", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"inputVarNames0", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{
         RowBox[{"inputVarNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputVariables", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"inputVarNames0", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"ToString", "[", 
          RowBox[{"inputVariables", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"id1", "=", "0"}], ";", "\[IndentingNewLine]", 
     RowBox[{"id", "=", "0"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputParameters", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "3"}], "]"}], "]"}], "]"}], ",", "\"\< \>\"",
             ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputParameters", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<;\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", "   ", 
        RowBox[{"id", "=", 
         RowBox[{"id1", "+", "1"}]}], ";", "\[IndentingNewLine]", "   ", 
        RowBox[{"id1", "=", "id"}], ";", "\[IndentingNewLine]", "   ", 
        RowBox[{
         RowBox[{"declaredVariables", "[", 
          RowBox[{"[", "id", "]"}], "]"}], "=", 
         RowBox[{"ToExpression", "[", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputParameters", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], "]"}]}], 
        ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<     Port *mpP\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"nodeConnections", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDA", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "systemEquationsDA", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"systemEquationsDa", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"systemEquationsDa", "[", 
            RowBox[{"[", "i", "]"}], "]"}], "=", 
           RowBox[{
            RowBox[{"systemEquationsDA", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "-", 
            RowBox[{"systemEquationsDA", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "2"}], "]"}], "]"}]}]}]}], "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemBoundaryEquations", "]"}], ">", "1"}], 
       ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "systemBoundaryEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"boundaryEquations", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", "n"}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"boundaryEquations", "[", 
            RowBox[{"[", "i", "]"}], "]"}], "=", 
           RowBox[{
            RowBox[{"systemBoundaryEquations", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "-", 
            RowBox[{"systemBoundaryEquations", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "2"}], "]"}], "]"}]}]}]}], "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"systemEquations", "=", 
         RowBox[{"Flatten", "[", 
          RowBox[{"{", 
           RowBox[{"systemEquationsDa", ",", "boundaryEquations"}], "}"}], 
          "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<     \>\"", ",", 
               RowBox[{"ToString", "[", "\"\<double \>\"", "]"}], ",", 
               RowBox[{"ToString", "[", "\"\<delayParts\>\"", "]"}], ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[9];\>\""}], 
              "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
        "\[IndentingNewLine]", "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     \>\"", ",", 
            RowBox[{"ToString", "[", "\"\<Matrix \>\"", "]"}], ",", 
            "\"\<jacobianMatrix;\>\""}], "]"}]}], "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     \>\"", ",", 
            RowBox[{"ToString", "[", "\"\<Vec \>\"", "]"}], ",", 
            "\"\<systemEquations;\>\""}], "]"}]}], "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     \>\"", ",", 
            RowBox[{"ToString", "[", "\"\<Matrix \>\"", "]"}], ",", 
            "\"\<delayedPart;\>\""}], "]"}]}], "]"}], ";", 
        "\[IndentingNewLine]", "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", "\"\<     int i;\>\""}], "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", "\"\<     int iter;\>\""}], "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", "\"\<     int mNoiter;\>\""}], "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", "\"\<     double jsyseqnweight[4];\>\""}], 
         "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"Depth", "[", "boundaryEquations", "]"}], ">", "1"}], ",", 
          "\[IndentingNewLine]", 
          RowBox[{"systemEquations", "=", 
           RowBox[{"Flatten", "[", 
            RowBox[{"{", 
             RowBox[{"systemEquationsDa", ",", "boundaryEquations"}], "}"}], 
            "]"}]}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", 
          RowBox[{"systemEquations", "=", "systemEquationsDa"}]}], 
         "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"nSE", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     int order[\>\"", ",", 
            RowBox[{"ToString", "[", " ", "nSE", "]"}], ",", "\"\<];\>\""}], 
           "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     int mNstep;\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"systemEquations", "=."}], ";", "\[IndentingNewLine]", 
     RowBox[{"delayExpressions", "=."}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"Depth", "[", "boundaryEquations", "]"}], ">", "1"}], ",", 
          "\[IndentingNewLine]", 
          RowBox[{"systemEquations", "=", 
           RowBox[{"Flatten", "[", 
            RowBox[{"{", 
             RowBox[{"systemEquationsDa", ",", "boundaryEquations"}], "}"}], 
            "]"}]}], "\[IndentingNewLine]", ",", "\[IndentingNewLine]", 
          RowBox[{"systemEquations", "=", "systemEquationsDa"}]}], 
         "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"stateVariables", "=", "variables"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"variables", "=", "systemVariables"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"stateVariables", "=", "systemVariables"}], ";", 
        "\[IndentingNewLine]", " ", 
        RowBox[{"i", "=", "1"}], ";", 
        RowBox[{"n", "=", "2"}], ";", "\[IndentingNewLine]", 
        RowBox[{"nv", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"eqn11", " ", "=", " ", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"eqn22", " ", "=", " ", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"Gfunc", " ", "=", " ", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"Gcomp", "=", " ", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", 
            RowBox[{"nv", ",", "6"}], "}"}]}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"an", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"nev", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"eqnCoeff1", "=", " ", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", 
            RowBox[{"nv", ",", "6"}], "}"}], ",", 
           RowBox[{"{", 
            RowBox[{"1", ",", "0"}], "}"}]}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"syseq", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"syseqC", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"dValue", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"delayedValue", ",", 
           RowBox[{"{", 
            RowBox[{"nv", ",", "6"}], "}"}]}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"delayOrder", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", "nv", "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{"delayExpressions", "=", 
         RowBox[{"Array", "[", 
          RowBox[{"a", ",", 
           RowBox[{"{", 
            RowBox[{"nv", ",", "6"}], "}"}]}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"nSE", "=", "0"}], ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"nv", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\n", "\t", 
          RowBox[{
           RowBox[{"s", "=."}], ";", "\n", "\t", 
           RowBox[{"mqi", "=."}], ";", "\n", "\t", 
           RowBox[{"pqi", "=."}], ";", "\n", "\t", 
           RowBox[{"eqnaa", " ", "=", " ", 
            RowBox[{"Numerator", "[", 
             RowBox[{"Together", "[", 
              RowBox[{"systemEquations", "[", 
               RowBox[{"[", "i", "]"}], "]"}], " ", "]"}], "]"}]}], ";", "\n",
            "\t", 
           RowBox[{
            RowBox[{"nev", "[", 
             RowBox[{"[", "i", "]"}], "]"}], " ", "=", " ", 
            RowBox[{"Exponent", "[", 
             RowBox[{"eqnaa", ",", "s"}], "]"}]}], ";", "\[IndentingNewLine]", 
           RowBox[{"ne", " ", "=", " ", 
            RowBox[{"Exponent", "[", 
             RowBox[{"eqnaa", ",", "s"}], "]"}]}], ";", "\[IndentingNewLine]",
            "     ", 
           RowBox[{"eqnCoeff", "=", 
            RowBox[{"Array", "[", 
             RowBox[{"a", ",", 
              RowBox[{"{", "ne", "}"}], ",", 
              RowBox[{"{", "0", "}"}]}], "]"}]}], ";", "\n", "\t", 
           RowBox[{"eqndd", " ", "=", " ", 
            RowBox[{"Expand", "[", 
             RowBox[{"Together", "[", "eqnaa", "]"}], "]"}]}], ";", "\n", 
           "\t", 
           RowBox[{"s", " ", "=", " ", 
            RowBox[{
             RowBox[{"(", 
              RowBox[{"2", "/", "mTimestep"}], ")"}], 
             RowBox[{
              RowBox[{"(", "mqi", ")"}], "/", 
              RowBox[{"(", "pqi", ")"}]}]}]}], ";", "\n", "\t", 
           RowBox[{"eqnbb", " ", "=", " ", 
            RowBox[{"Expand", "[", 
             RowBox[{"eqndd", " ", 
              RowBox[{
               RowBox[{"(", "pqi", ")"}], "^", "ne"}]}], "]"}]}], ";", "\n", 
           "\t", 
           RowBox[{"pqi", " ", "=", " ", 
            RowBox[{"1", "+", "qi00"}]}], ";", "\n", "\t", 
           RowBox[{"mqi", " ", "=", " ", 
            RowBox[{"1", "-", "qi00"}]}], ";", "\[IndentingNewLine]", " ", 
           RowBox[{"DelayOperator", "=", "qi00"}], ";", "\n", "\t", 
           RowBox[{"eqn33", " ", "=", " ", 
            RowBox[{"Numerator", "[", 
             RowBox[{"Together", "[", " ", 
              RowBox[{"Expand", "[", "eqnbb", "]"}], "]"}], "]"}]}], ";", 
           "\n", "\t", 
           RowBox[{"eqnaa3", "=", 
            RowBox[{"Numerator", "[", 
             RowBox[{"Together", "[", 
              RowBox[{"Expand", "[", "eqndd", "]"}], "]"}], "]"}]}], ";", 
           "\[IndentingNewLine]", " ", 
           RowBox[{"ne", " ", "=", " ", 
            RowBox[{"Exponent", "[", 
             RowBox[{"eqn33", ",", "qi00"}], "]"}]}], ";", 
           "\[IndentingNewLine]", " ", 
           RowBox[{"ne", " ", "=", " ", 
            RowBox[{"Exponent", "[", 
             RowBox[{"eqnaa3", ",", "qi00"}], "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"delayOrder", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "=", "ne"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"eqn22", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "=", 
            RowBox[{"Collect", "[", 
             RowBox[{"eqn33", ",", "qi00"}], "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"j", "=", "0"}], ";", "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"eqnCoeff1", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", 
            RowBox[{"Coefficient", "[", 
             RowBox[{
              RowBox[{"eqn22", "[", 
               RowBox[{"[", "i", "]"}], "]"}], ",", "qi00", ",", "j"}], 
             "]"}]}], ";", "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"an", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "=", 
            RowBox[{"Coefficient", "[", 
             RowBox[{
              RowBox[{"eqnCoeff1", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "j"}], "]"}], "]"}], ",", 
              RowBox[{"systemVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}], ";", 
           "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"eqnCoeff1", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", 
            RowBox[{
             RowBox[{"systemVariables", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "+", 
             RowBox[{"Simplify", "[", 
              RowBox[{
               RowBox[{
                RowBox[{"Coefficient", "[", 
                 RowBox[{
                  RowBox[{"eqn22", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], ",", "qi00", ",", "j"}], 
                 "]"}], "/", 
                RowBox[{"an", "[", 
                 RowBox[{"[", "i", "]"}], "]"}]}], "-", 
               RowBox[{"systemVariables", "[", 
                RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"Gfunc", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "=", " ", 
            RowBox[{"eqnCoeff1", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "j"}], "]"}], "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"Gcomp", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", " ", 
            RowBox[{"eqnCoeff1", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "j"}], "]"}], "]"}]}], ";", 
           "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"n", "=", 
            RowBox[{"Length", "[", "variableLimits", "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"nLow", "=", 
            RowBox[{"Length", "[", "variableLowLimits", "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"m", "=", " ", 
            RowBox[{"Length", "[", "variable2Limits", "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{
               RowBox[{"delayOrder", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{
              RowBox[{"Gcomp", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", 
              RowBox[{
               RowBox[{"systemVariables", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "+", 
               RowBox[{"Simplify", "[", 
                RowBox[{
                 RowBox[{
                  RowBox[{"Coefficient", "[", 
                   RowBox[{
                    RowBox[{"eqn22", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], ",", "qi00", ",", "0"}], 
                   "]"}], "/", 
                  RowBox[{"an", "[", 
                   RowBox[{"[", "i", "]"}], "]"}]}], "-", 
                 RowBox[{"systemVariables", "[", 
                  RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}]}], 
            "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
           "\[IndentingNewLine]", 
           RowBox[{"Gfunc1", "=", " ", 
            RowBox[{"Gfunc", "[", 
             RowBox[{"[", "i", "]"}], "]"}]}], ";", "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{
               RowBox[{"delayOrder", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{
              RowBox[{
               RowBox[{"Gfunc", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "=", 
               RowBox[{"Gfunc1", "+", " ", 
                RowBox[{"delayedPart", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "j"}], "]"}], "]"}]}]}], ";", 
              "\[IndentingNewLine]", 
              RowBox[{"Gfunc1", "=", 
               RowBox[{"Gfunc", "[", 
                RowBox[{"[", "i", "]"}], "]"}]}], ";"}]}], 
            "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{"n", "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{"If", "[", 
              RowBox[{
               RowBox[{
                RowBox[{"systemVariables", "[", 
                 RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", 
                RowBox[{
                 RowBox[{"variableLimits", " ", "[", 
                  RowBox[{"[", "j", "]"}], "]"}], "[", 
                 RowBox[{"[", "1", "]"}], "]"}]}], ",", "\[IndentingNewLine]", 
               RowBox[{
                RowBox[{"Gfunc1", "=", 
                 RowBox[{
                  RowBox[{"systemVariables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "-", 
                  RowBox[{"limit", "[", 
                   RowBox[{
                    RowBox[{
                    RowBox[{"Simplify", "[", 
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "]"}], "-", 
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], ",", 
                    RowBox[{
                    RowBox[{"variableLimits", " ", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "2", "]"}], "]"}], ",", 
                    RowBox[{
                    RowBox[{"variableLimits", " ", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "3", "]"}], "]"}]}], "]"}]}]}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{
                 RowBox[{"Gfunc", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], "=", "Gfunc1"}], ";"}], 
               "\[IndentingNewLine]", ",", "\[IndentingNewLine]", 
               RowBox[{
                RowBox[{"Gfunc1", "=", 
                 RowBox[{
                  RowBox[{"systemVariables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "+", 
                  RowBox[{"Simplify", "[", 
                   RowBox[{
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "-", 
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{
                 RowBox[{"Gfunc", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], "=", "Gfunc1"}], ";"}]}], 
              "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}], 
           ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{"nLow", "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{"If", "[", 
              RowBox[{
               RowBox[{
                RowBox[{"systemVariables", "[", 
                 RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", 
                RowBox[{
                 RowBox[{"variableLowLimits", " ", "[", 
                  RowBox[{"[", "j", "]"}], "]"}], "[", 
                 RowBox[{"[", "1", "]"}], "]"}]}], ",", "\[IndentingNewLine]", 
               RowBox[{
                RowBox[{"Gfunc1", "=", 
                 RowBox[{
                  RowBox[{"systemVariables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "-", 
                  RowBox[{"lowLimit", "[", 
                   RowBox[{
                    RowBox[{
                    RowBox[{"Simplify", "[", 
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "]"}], "-", 
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], ",", 
                    RowBox[{
                    RowBox[{"variableLowLimits", " ", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "2", "]"}], "]"}]}], "]"}]}]}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{
                 RowBox[{"Gfunc", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], "=", "Gfunc1"}], ";"}], 
               "\[IndentingNewLine]", ",", "\[IndentingNewLine]", 
               RowBox[{
                RowBox[{"Gfunc1", "=", 
                 RowBox[{
                  RowBox[{"systemVariables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "+", 
                  RowBox[{"Simplify", "[", 
                   RowBox[{
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "-", 
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{
                 RowBox[{"Gfunc", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], "=", "Gfunc1"}], ";"}]}], 
              "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", 
            "]"}]}]}], "\[IndentingNewLine]", "\[IndentingNewLine]", "]"}], 
        ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"nv", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"j", "=", "0"}], ";", "\[IndentingNewLine]", " ", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{"m", "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{"If", "[", 
              RowBox[{
               RowBox[{
                RowBox[{"systemVariables", "[", 
                 RowBox[{"[", "i", "]"}], "]"}], "\[Equal]", 
                RowBox[{
                 RowBox[{"variable2Limits", "[", 
                  RowBox[{"[", "j", "]"}], "]"}], "[", 
                 RowBox[{"[", "1", "]"}], "]"}]}], ",", "\[IndentingNewLine]", 
               RowBox[{
                RowBox[{"Gfunc1", "=", 
                 RowBox[{
                  RowBox[{"systemVariables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "-", 
                  RowBox[{"limit", "[", 
                   RowBox[{
                    RowBox[{"Simplify", "[", 
                    RowBox[{
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "-", 
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], "]"}], ",", 
                    RowBox[{
                    RowBox[{"variable2Limits", " ", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "3", "]"}], "]"}], ",", 
                    RowBox[{
                    RowBox[{"variable2Limits", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "4", "]"}], "]"}]}], "]"}]}]}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{
                 RowBox[{"Gfunc", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], "=", "Gfunc1"}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{"For", "[", 
                 RowBox[{
                  RowBox[{"i1", "=", "1"}], ",", 
                  RowBox[{"i1", "<", 
                   RowBox[{"nv", "+", "1"}]}], ",", 
                  RowBox[{"i1", "++"}], ",", "\n", "\t\t", 
                  RowBox[{"If", "[", 
                   RowBox[{
                    RowBox[{
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i1", "]"}], "]"}], "\[Equal]", 
                    RowBox[{
                    RowBox[{"variable2Limits", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "2", "]"}], "]"}]}], ",", 
                    "\[IndentingNewLine]", 
                    RowBox[{
                    RowBox[{"Gfunc1", "=", 
                    RowBox[{
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i1", "]"}], "]"}], "-", 
                    RowBox[{
                    RowBox[{"(", 
                    RowBox[{
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i1", "]"}], "]"}], "-", 
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i1", "]"}], "]"}]}], ")"}], "*", 
                    RowBox[{"dxLimit", "[", 
                    RowBox[{
                    RowBox[{"Simplify", "[", 
                    RowBox[{
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "-", 
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], "]"}], ",", 
                    RowBox[{
                    RowBox[{"variable2Limits", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "3", "]"}], "]"}], ",", 
                    RowBox[{
                    RowBox[{"variable2Limits", "[", 
                    RowBox[{"[", "j", "]"}], "]"}], "[", 
                    RowBox[{"[", "4", "]"}], "]"}]}], "]"}]}]}]}], ";", 
                    "\[IndentingNewLine]", 
                    RowBox[{
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i1", "]"}], "]"}], "=", "Gfunc1"}], ";"}]}],
                    "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", 
                 "]"}], ";"}], "\[IndentingNewLine]", ",", 
               "\[IndentingNewLine]", 
               RowBox[{
                RowBox[{"Gfunc1", "=", 
                 RowBox[{
                  RowBox[{"systemVariables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "+", 
                  RowBox[{"Simplify", "[", 
                   RowBox[{
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", "i", "]"}], "]"}], "-", 
                    RowBox[{"systemVariables", "[", 
                    RowBox[{"[", "i", "]"}], "]"}]}], "]"}]}]}], ";", 
                "\[IndentingNewLine]", 
                RowBox[{
                 RowBox[{"Gfunc", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], "=", "Gfunc1"}], ";"}]}], 
              "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}], 
           ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"j", "=", "0"}], ";", "\[IndentingNewLine]", " ", 
           RowBox[{
            RowBox[{"delayExpressions", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", 
            RowBox[{"StringJoin", "[", 
             RowBox[{"\"\<delayParts\>\"", ",", 
              RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[\>\"", ",", 
              RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<] = \>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"CForm", "[", 
                RowBox[{"eqnCoeff1", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "j"}], "]"}], "]"}], "]"}], "]"}], ",", 
              "\"\<;\>\""}], "]"}]}], ";", "\[IndentingNewLine]", 
           "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{
               RowBox[{"nev", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", "\t", 
             RowBox[{
              RowBox[{
               RowBox[{"eqnCoeff1", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", 
               RowBox[{
                RowBox[{"Coefficient", "[", 
                 RowBox[{
                  RowBox[{"eqn22", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], ",", "qi00", ",", "j"}], 
                 "]"}], "/", 
                RowBox[{"an", "[", 
                 RowBox[{"[", "i", "]"}], "]"}]}]}], ";", 
              "\[IndentingNewLine]", "         ", 
              RowBox[{
               RowBox[{"delayExpressions", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "j"}], "]"}], "]"}], "=", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<delayParts\>\"", ",", 
                 RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[\>\"", ",", 
                 RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<] = \>\"", 
                 ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"CForm", "[", 
                   RowBox[{"eqnCoeff1", "[", 
                    RowBox[{"[", 
                    RowBox[{"i", ",", "j"}], "]"}], "]"}], "]"}], "]"}], ",", 
                 "\"\<;\>\""}], "]"}]}], ";"}]}], "\[IndentingNewLine]", 
            "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
           "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"j", "=", "0"}], ";", "\[IndentingNewLine]", 
           RowBox[{"syseq1", "=", 
            RowBox[{"ToString", "[", 
             RowBox[{"CForm", "[", 
              RowBox[{"eqnCoeff1", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "j"}], "]"}], "]"}], "]"}], "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"syseq", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "=", 
            RowBox[{"StringJoin", "[", 
             RowBox[{"\"\<delayParts\>\"", ",", 
              RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[0]\>\""}], 
             "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{"ne", "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{
              RowBox[{
               RowBox[{"syseq", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "=", 
               RowBox[{"StringJoin", "[", 
                RowBox[{
                 RowBox[{"syseq", "[", 
                  RowBox[{"[", "i", "]"}], "]"}], ",", "\"\<+\>\"", ",", 
                 RowBox[{"StringJoin", "[", 
                  RowBox[{"\"\<mDelayedPart\>\"", ",", 
                   RowBox[{"ToString", "[", "i", "]"}], ",", 
                   RowBox[{"ToString", "[", "j", "]"}], ",", 
                   "\"\<.getIdx(\>\"", ",", 
                   RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<)\>\""}], 
                  "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", "       ", 
              RowBox[{"syseq1", "=", 
               RowBox[{"syseq", "[", 
                RowBox[{"[", "i", "]"}], "]"}]}], ";", "\[IndentingNewLine]", 
              "       ", 
              RowBox[{
               RowBox[{"syseqC", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "=", 
               RowBox[{"syseq", "[", 
                RowBox[{"[", "i", "]"}], "]"}]}], ";"}]}], 
            "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", 
         "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"jacob", "=", 
         RowBox[{"PartialDerivatives", "[", 
          RowBox[{"Gfunc", ",", "systemVariables"}], "]"}]}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"m", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     //Port P\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\< variable\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"m", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<     double \>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}], 
                "]"}], ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
               "\"\<;\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
           "   ", 
           RowBox[{"id", "=", 
            RowBox[{"id1", "+", "1"}]}], ";", "\[IndentingNewLine]", "   ", 
           RowBox[{"id1", "=", "id"}], ";", "\[IndentingNewLine]", "   ", 
           RowBox[{
            RowBox[{"declaredVariables", "[", 
             RowBox[{"[", "id", "]"}], "]"}], "=", 
            RowBox[{"ToExpression", "[", 
             RowBox[{"StringJoin", "[", 
              RowBox[{
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}], 
                "]"}], ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}], 
             "]"}]}], ";"}]}], "\[IndentingNewLine]", "]"}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", "\"\<     //inputVariables\>\"", "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     double \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputVarNames", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\<;\>\""}], 
           "]"}]}], "]"}], ";", "\[IndentingNewLine]", " ", 
        RowBox[{"id", "=", 
         RowBox[{"id1", "+", "1"}]}], ";", "\[IndentingNewLine]", " ", 
        RowBox[{"id1", "=", "id"}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"declaredVariables", "[", 
          RowBox[{"[", "id", "]"}], "]"}], "=", 
         RowBox[{"inputVarNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}]}]}]}], "\[IndentingNewLine]", "]"}], 
     ";", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]",
      "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "outputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", "\"\<     //outputVariables\>\"", "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     double \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<;\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", " ", 
        RowBox[{"id", "=", 
         RowBox[{"id1", "+", "1"}]}], ";", "\[IndentingNewLine]", " ", 
        RowBox[{"id1", "=", "id"}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"declaredVariables", "[", 
          RowBox[{"[", "id", "]"}], "]"}], "=", 
         RowBox[{"outputVariables", "[", 
          RowBox[{"[", 
           RowBox[{"i", ",", "1"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"Print", "[", 
         RowBox[{"\"\<DV\>\"", ",", "id", ",", 
          RowBox[{"outputVariables", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "1"}], "]"}], "]"}]}], "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "initialExpressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<     //InitialExpressions variables\>\""}], 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "  ", 
       RowBox[{
        RowBox[{"declared", "=", "False"}], ";", "\[IndentingNewLine]", "  ", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"id", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", 
          RowBox[{
           RowBox[{"If", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"initialExpressions", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "\[Equal]", 
              RowBox[{"declaredVariables", "[", 
               RowBox[{"[", "j", "]"}], "]"}]}], ",", 
             RowBox[{"declared", "=", "True"}]}], "]"}], ";", 
           "\[IndentingNewLine]", " ", 
           RowBox[{"Print", "[", 
            RowBox[{"\"\<IE\>\"", ",", 
             RowBox[{"initialExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], ",", "\"\<DV\>\"", ",", 
             RowBox[{"declaredVariables", "[", 
              RowBox[{"[", "j", "]"}], "]"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{"declared", "\[Equal]", "False"}], ",", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<     double \>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"CForm", "[", 
                 RowBox[{"initialExpressions", "[", 
                  RowBox[{"[", 
                   RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
               "\"\<;\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", " ", 
           RowBox[{"id", "=", 
            RowBox[{"id1", "+", "1"}]}], ";", "\[IndentingNewLine]", " ", 
           RowBox[{"id1", "=", "id"}], ";", "\[IndentingNewLine]", 
           RowBox[{
            RowBox[{"declaredVariables", "[", 
             RowBox[{"[", "id", "]"}], "]"}], "=", 
            RowBox[{"initialExpressions", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}]}], ";"}]}], 
         "\[IndentingNewLine]", "]"}]}]}], "\[IndentingNewLine]", 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "localExpressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<     //LocalExpressions variables\>\""}], 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "  ", 
       RowBox[{
        RowBox[{"declared", "=", "False"}], ";", "\[IndentingNewLine]", "  ", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"id", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", 
          RowBox[{
           RowBox[{"If", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"localExpressions", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "\[Equal]", 
              RowBox[{"declaredVariables", "[", 
               RowBox[{"[", "j", "]"}], "]"}]}], ",", 
             RowBox[{"declared", "=", "True"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{"declared", "\[Equal]", "False"}], ",", 
          RowBox[{
           RowBox[{
            RowBox[{"WriteCode", "[", 
             RowBox[{"file", ",", 
              RowBox[{"StringJoin", "[", 
               RowBox[{"\"\<     double \>\"", ",", 
                RowBox[{"ToString", "[", 
                 RowBox[{"CForm", "[", 
                  RowBox[{"localExpressions", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
                "\"\<;\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
            "\[IndentingNewLine]", " ", 
            RowBox[{"id", "=", 
             RowBox[{"id1", "+", "1"}]}], ";", "\[IndentingNewLine]", " ", 
            RowBox[{"id1", "=", "id"}], ";", "\[IndentingNewLine]", 
            RowBox[{
             RowBox[{"declaredVariables", "[", 
              RowBox[{"[", "id", "]"}], "]"}], "=", 
             RowBox[{"localExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}]}], ";"}], "'"}]}], 
         "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";"}], "*)"}], 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "expressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<     //Expressions variables\>\""}], 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"declared", "=", "False"}], ";", "\[IndentingNewLine]", "  ", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"id", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", " ", 
          RowBox[{
           RowBox[{"If", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"expressions", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "\[Equal]", 
              RowBox[{"declaredVariables", "[", 
               RowBox[{"[", "j", "]"}], "]"}]}], ",", 
             RowBox[{"declared", "=", "True"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
        "\[IndentingNewLine]", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{"declared", "\[Equal]", "False"}], ",", 
          RowBox[{"WriteCode", "[", 
           RowBox[{"file", ",", 
            RowBox[{"StringJoin", "[", 
             RowBox[{"\"\<     double \>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"CForm", "[", 
                RowBox[{"expressions", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
              "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", 
         "]"}]}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"m", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     //Port P\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\< pointer\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"m", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<     double *mpND_\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}], 
                "]"}], ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
               "\"\<;\>\""}], "]"}]}], "]"}], ";"}]}], "]"}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<     //Delay declarations\>\"", "]"}]}], "]"}],
      ";", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "stepDelays", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<     \>\"", ",", 
            RowBox[{"ToString", "[", "\"\<Delay mDelay\>\"", "]"}], ",", 
            RowBox[{"ToString", "[", 
             RowBox[{
              RowBox[{"stepDelayVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\<;\>\""}], 
           "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<     //inputVariables pointers\>\"", "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<     double *mp\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputVariables", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<     //inputParameters pointers\>\"", "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<     double *mp\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputParameters", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "outputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<     //outputVariables pointers\>\"", "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<     double *mp\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"outputVariables", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "systemEquationsDa", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "0"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{
            RowBox[{"delayOrder", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<     \>\"", ",", 
               RowBox[{"ToString", "[", "\"\<Delay \>\"", "]"}], ",", 
               RowBox[{"ToString", "[", "\"\<mDelayedPart\>\"", "]"}], ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<;\>\""}], 
              "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     EquationSystemSolver *mpSolver;\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<public:\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     static Component *Creator()\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     {\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
          "\"\<        std::cout << \>\"", ",", "\"\<\\\"running \>\"", ",", 
           "componentName", ",", "\"\< creator\\\"\>\"", ",", 
           "\"\< << std::endl;\>\""}], "]"}]}], "]"}], ";"}], "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{
        "\"\<        return new \>\"", ",", "componentName", ",", 
         "\"\<();\>\""}], "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     }\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"np", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"nv", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"creatorParameters", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", 
        RowBox[{"{", 
         RowBox[{"np", "+", "nv"}], "}"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"creatorNames", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", 
        RowBox[{"{", 
         RowBox[{"np", "+", "nv"}], "}"}]}], "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"np", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{
         RowBox[{"creatorParameters", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"inputParameters", "[", 
          RowBox[{"[", "i", "]"}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"creatorNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}], "=", 
         RowBox[{"inputParNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}]}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"nv", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{
         RowBox[{"creatorParameters", "[", 
          RowBox[{"[", 
           RowBox[{"np", "+", "i"}], "]"}], "]"}], "=", 
         RowBox[{"inputVariables", "[", 
          RowBox[{"[", "i", "]"}], "]"}]}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"creatorNames", "[", 
          RowBox[{"[", 
           RowBox[{"np", "+", "i"}], "]"}], "]"}], "=", 
         RowBox[{"inputVarNames", "[", 
          RowBox[{"[", "i", "]"}], "]"}]}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"nc", "=", 
      RowBox[{"np", "+", "nv"}]}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", "\"\<     void configure()\>\"", "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     {\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        mNstep=9;\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"nSE", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        jacobianMatrix.create(\>\"", ",", 
            RowBox[{"ToString", "[", "nSE", "]"}], ",", "\"\<,\>\"", ",", 
            RowBox[{"ToString", "[", "nSE", "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";", " ", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        systemEquations.create(\>\"", ",", 
            RowBox[{"ToString", "[", "nSE", "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        delayedPart.create(\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nSE", "+", "1"}], "]"}], ",", "\"\<,6);\>\""}], "]"}]}],
          "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", "\"\<        mNoiter=2;\>\""}], "]"}], 
         "\[IndentingNewLine]", "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", "\"\<        jsyseqnweight[0]=1;\>\""}], "]"}],
          "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", "\"\<        jsyseqnweight[1]=0.67;\>\""}], 
          "]"}], "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", "\"\<        jsyseqnweight[2]=0.5;\>\""}], 
          "]"}], "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", "\"\<        jsyseqnweight[3]=0.5;\>\""}], 
          "]"}], "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", "\"\<\>\""}], "]"}]}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //Add ports to the component\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"If", "[", 
        RowBox[{
         RowBox[{
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "3"}], "]"}], "]"}], "\[Equal]", 
          "\"\<WritePort\>\""}], ",", "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        mpP\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
             "\"\<=add\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "3"}], "]"}], "]"}], "]"}], ",", 
             "\"\<(\>\"", ",", "\"\<\\\"P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
             "\"\<\\\"\>\"", ",", "\"\<,\>\"", ",", "\"\<\\\"\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "4"}], "]"}], "]"}], "]"}], ",", 
             "\"\<\\\"\>\"", ",", "\"\<, Port::NOTREQUIRED);\>\""}], "]"}]}], 
          "]"}], ",", "\[IndentingNewLine]", 
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        mpP\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
             "\"\<=add\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "3"}], "]"}], "]"}], "]"}], ",", 
             "\"\<(\>\"", ",", "\"\<\\\"P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
             "\"\<\\\"\>\"", ",", "\"\<,\>\"", ",", "\"\<\\\"\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "4"}], "]"}], "]"}], "]"}], ",", 
             "\"\<\\\"\>\"", ",", "\"\<);\>\""}], "]"}]}], "]"}]}], 
        "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Add inputVariables to the component\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
          "\"\<            addInputVariable(\>\"", ",", "\"\<\\\"\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputVariables", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
           "\"\<\\\"\>\"", ",", "\"\<,\>\"", ",", "\"\<\\\"\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputVariables", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "5"}], "]"}], "]"}], "]"}], ",", 
           "\"\<\\\"\>\"", ",", "\"\<,\>\"", ",", "\"\<\\\"\>\"", ",", "\n", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputVariables", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "4"}], "]"}], "]"}], "]"}], ",", 
           "\"\<\\\"\>\"", ",", "\"\<,\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"inputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "2"}], "]"}], "]"}], "]"}], "]"}], ",", 
           "\"\<,\>\"", ",", "\"\<&mp\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"inputVariables", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
           "\"\<);\>\""}], "]"}]}], "]"}]}], " ", "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", 
       "\"\<        //Add inputParammeters to the component\>\""}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "inputParameters", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{"WriteCode", "[", 
           RowBox[{"file", ",", 
            RowBox[{"StringJoin", "[", 
             RowBox[{
             "\"\<            addInputVariable(\>\"", ",", "\"\<\\\"\>\"", 
              ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"inputParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\\\", \\\"\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"inputParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "5"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\\\", \>\"", ",", "\"\<\\\"\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"inputParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "4"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\\\", \>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"CForm", "[", 
                RowBox[{"inputParameters", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "2"}], "]"}], "]"}], "]"}], "]"}], ",", 
              "\"\<,\>\"", ",", "\"\<&mp\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"inputParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
              "\"\<);\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", 
         "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Add outputVariables to the component\>\""}],
       "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "outputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
          "\"\<            addOutputVariable(\>\"", ",", "\"\<\\\"\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "[", 
             RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\<\\\"\>\"", ",", 
           "\"\<,\>\"", ",", "\"\<\\\"\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "[", 
             RowBox[{"[", "5", "]"}], "]"}], "]"}], ",", "\"\<\\\"\>\"", ",", 
           "\"\<,\>\"", ",", "\"\<\\\"\>\"", ",", "\n", 
           RowBox[{"ToString", "[", 
            RowBox[{
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "[", 
             RowBox[{"[", "4", "]"}], "]"}], "]"}], ",", "\"\<\\\"\>\"", ",", 
           "\"\<,\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{
              RowBox[{"outputVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "[", 
              RowBox[{"[", "2", "]"}], "]"}], "]"}], "]"}], ",", "\"\<,\>\"", 
           ",", "\"\<&mp\>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "[", 
             RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\<);\>\""}], 
          "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //Add constantParameters\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "constantParameters", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "constantParameters", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{"WriteCode", "[", 
           RowBox[{"file", ",", 
            RowBox[{"StringJoin", "[", 
             RowBox[{
             "\"\<            addConstant(\>\"", ",", "\"\<\\\"\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"constantParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\\\", \\\"\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"constantParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "5"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\\\", \>\"", ",", "\"\<\\\"\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"constantParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "4"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\\\", \>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"CForm", "[", 
                RowBox[{"constantParameters", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "2"}], "]"}], "]"}], "]"}], "]"}], ",", 
              "\"\<,\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"constantParameters", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
              "\"\<);\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", 
         "]"}]}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "systemVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
          "\"\<        mpSolver = new EquationSystemSolver(this,\>\"", ",", 
           RowBox[{"ToString", "[", "n", "]"}], ",", "\"\<);\>\""}], "]"}]}], 
        "]"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     }\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<    void initialize()\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     {\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", 
       "\"\<        //Read port variable pointers from nodes\>\""}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"m", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        //Port P\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], "]"}],
         ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"m", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        mpND_\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}], 
                "]"}], ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
               "\"\<=getSafeNodeDataPtr(mpP\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
               "\"\<, \>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "4"}], "]"}], "]"}], "]"}], ",", 
               "\"\<::\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "6", ",", "j", ",", "5"}], "]"}], "]"}], 
                "]"}], ",", "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}]}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"(*", " ", 
      RowBox[{"This", " ", "should", " ", "work"}], " ", "*)"}], 
     "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";"}], "*)"}], 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{
        "file", ",", "\"\<        //Write start values to nodes\>\""}], "]"}],
        ";", "\[IndentingNewLine]", 
       RowBox[{"n", "=", 
        RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
       "\[IndentingNewLine]", 
       RowBox[{"For", "[", 
        RowBox[{
         RowBox[{"i", "=", "1"}], ",", 
         RowBox[{"i", "<", 
          RowBox[{"n", "+", "1"}]}], ",", 
         RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
         RowBox[{
          RowBox[{"m", "=", 
           RowBox[{"Length", "[", 
            RowBox[{"nodeConnections", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
          "\[IndentingNewLine]", 
          RowBox[{"WriteCode", "[", 
           RowBox[{"file", ",", 
            RowBox[{"StringJoin", "[", 
             RowBox[{"\"\<        //Port P\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"nodeConnections", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
           "]"}], ";", "\[IndentingNewLine]", 
          RowBox[{"For", "[", 
           RowBox[{
            RowBox[{"j", "=", "1"}], ",", 
            RowBox[{"j", "<", 
             RowBox[{"m", "+", "1"}]}], ",", 
            RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
            RowBox[{"WriteCode", "[", 
             RowBox[{"file", ",", 
              RowBox[{"StringJoin", "[", "\"\<        \>", 
               RowBox[{"(*", 
                RowBox[{
                 RowBox[{
                  RowBox[{
                   RowBox[{
                   "mpND_", 
                    "\"\<,ToString[nodeConnections[[i,6,j,1]]],ToString[\
nodeConnections[[i,1]]],\>\""}], ")"}], "=", 
                  RowBox[{"getStartValue", 
                   RowBox[{"(", 
                    RowBox[{
                    RowBox[{
                    "mpP", "\"\<,ToString[nodeConnections[[i,1]]],\>\""}], 
                    ",", " ", 
                    RowBox[{
                    "\"\<,ToString[nodeConnections[[i,4]]],\>\"", "::", 
                    "\"\<,ToString[nodeConnections[[i,6,j,5]]],\>\""}]}], 
                    ")"}]}]}], ";", 
                 RowBox[{
                 "\"\<]];\[IndentingNewLine]]\[IndentingNewLine]];\
\[IndentingNewLine]WriteCode[file,\>\"", "\"\<];\>"}]}], "*)"}], 
               "\[IndentingNewLine]", "\[IndentingNewLine]"}]}]}]}]}]}]}]}]}],
       "*)"}], "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //Read variables from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"m", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        //Port P\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], "]"}],
         ";", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"nodeConnections", "[", 
            RowBox[{"[", 
             RowBox[{"i", ",", "3"}], "]"}], "]"}], "\[Equal]", 
           "\"\<PowerPort\>\""}], ",", "\[IndentingNewLine]", 
          RowBox[{"For", "[", 
           RowBox[{
            RowBox[{"j", "=", "1"}], ",", 
            RowBox[{"j", "<", 
             RowBox[{"m", "+", "1"}]}], ",", 
            RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
            RowBox[{
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        \>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}],
                   "]"}], ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
                 "\"\< = (*mpND_\>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}],
                   "]"}], ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
                 "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], 
           "\[IndentingNewLine]", "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{
           RowBox[{"nodeConnections", "[", 
            RowBox[{"[", 
             RowBox[{"i", ",", "3"}], "]"}], "]"}], "\[Equal]", 
           "\"\<WritePort\>\""}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        \>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
               "\"\< = mpP\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
               "\"\<\[Rule]getStartValue(NodeSignal::VALUE);\>\""}], "]"}]}], 
            "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Read inputVariables from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"(*", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        //Port P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"inputVariables", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
          "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputVarNames", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\< = (*mp\>\"", 
            ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputVarNames", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Read inputParameters from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"(*", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        //Port P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"inputVariables", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
          "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputParNames", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\< = (*mp\>\"", 
            ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputParNames", "[", 
              RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{
        "file", ",", "\"\<        //Read inputVariables from nodes\>\""}], 
        "]"}], ";", "\[IndentingNewLine]", 
       RowBox[{"n", "=", 
        RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
       "\[IndentingNewLine]", 
       RowBox[{"For", "[", 
        RowBox[{
         RowBox[{"i", "=", "1"}], ",", 
         RowBox[{"i", "<", 
          RowBox[{"n", "+", "1"}]}], ",", 
         RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
         RowBox[{"(*", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        //Port P\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"inputVariables", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
            "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
         RowBox[{
          RowBox[{"WriteCode", "[", 
           RowBox[{"file", ",", 
            RowBox[{"StringJoin", "[", 
             RowBox[{"\"\<        \>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"inputVariables", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
              "\"\< = mpP\>\"", ",", 
              RowBox[{"ToString", "[", 
               RowBox[{"inputVariables", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
              "\"\<\[Rule]getStartValue(NodeSignal::VALUE);\>\""}], "]"}]}], 
           "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
       "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";"}], "*)"}], 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Read outputVariables from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "outputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"(*", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        //Port P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"outputVariables", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
          "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\< = (*mp\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "initialExpressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<        //InitialExpressions\>\""}], 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<        \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"initialExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
           "\"\< = \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"initialExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "2"}], "]"}], "]"}], " ", "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "localExpressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<        //LocalExpressions\>\""}], "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<        \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"localExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
           "\"\< = \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"localExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "2"}], "]"}], "]"}], " ", "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //Initialize delays\>\""}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{"delay", ".", "initialize"}], "*)"}], "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "stepDelays", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", "\"\<mDelay\>\"", "]"}], ",", 
            RowBox[{"ToString", "[", 
             RowBox[{
              RowBox[{"stepDelayVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", 
            "\"\<.initialize(mNstep,\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{
              RowBox[{"stepDelayVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"j", "=", "1"}], ",", 
             RowBox[{"j", "<", 
              RowBox[{
               RowBox[{"delayOrder", "[", 
                RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
             RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{
              RowBox[{"WriteCode", "[", 
               RowBox[{"file", ",", 
                RowBox[{"StringJoin", "[", 
                 RowBox[{"\"\<        \>\"", ",", 
                  RowBox[{"delayExpressions", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "j"}], "]"}], "]"}]}], "]"}]}], "]"}], 
              ";", "\[IndentingNewLine]", 
              RowBox[{"WriteCode", "[", 
               RowBox[{"file", ",", 
                RowBox[{"StringJoin", "[", 
                 RowBox[{"\"\<        \>\"", ",", 
                  RowBox[{"ToString", "[", "\"\<mDelayedPart\>\"", "]"}], ",", 
                  RowBox[{"ToString", "[", "i", "]"}], ",", 
                  RowBox[{"ToString", "[", "j", "]"}], ",", 
                  "\"\<.initialize(mNstep,delayParts\>\"", ",", 
                  RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[\>\"", ",", 
                  RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<]);\>\""}], 
                 "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], 
           ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", "2"}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        delayedPart[\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<][\>\"", ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", 
               "\"\<] = delayParts\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[\>\"", ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<];\>\""}], 
              "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "2"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{
            RowBox[{"delayOrder", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        delayedPart[\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<][\>\"", ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", 
               "\"\<] = mDelayedPart\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<.getIdx(\>\"", 
               ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"j", "-", "1"}], "]"}], ",", "\"\<);\>\""}], "]"}]}], 
            "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        simulateOneTimestep();\>\""}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     }\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<    void simulateOneTimestep()\>\""}], "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     {\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"timeDelaysT1", "=", "timeDelays"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "timeDelays", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"timeDelays", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "1"}], "]"}], "]"}], ",", 
            "\"\<.setTimeDelay(m\>\"", ",", 
            RowBox[{"timeDelays", "[", 
             RowBox[{"[", 
              RowBox[{"i", ",", "2"}], "]"}], "]"}], ",", 
            "\"\<-mNstep, mNstep)\>\""}], "]"}]}], "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"neq", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        Vec stateVar(\>\"", ",", 
            RowBox[{"ToString", "[", "neq", "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        Vec stateVark(\>\"", ",", 
            RowBox[{"ToString", "[", "neq", "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        Vec deltaStateVar(\>\"", ",", 
            RowBox[{"ToString", "[", "neq", "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", "\"\<\>\""}], "]"}]}]}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //Read variables from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"m", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        //Port P\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], "]"}],
         ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"m", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{"If", "[", 
           RowBox[{
            RowBox[{
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "6", ",", "j", ",", "6"}], "]"}], "]"}], 
             "\[Equal]", "\"\<in\>\""}], ",", "\[IndentingNewLine]", 
            RowBox[{
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        \>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}],
                   "]"}], ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
                 "\"\< = (*mpND_\>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}],
                   "]"}], ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
                 "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], 
           "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}]}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Read inputVariables from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"(*", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        //Port P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"inputVariables", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
          "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\< = (*mp\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{
      "file", ",", "\"\<        //Read inputParameters from nodes\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"(*", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        //Port P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"inputVariables", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
          "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputParameters", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\< = (*mp\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"inputParameters", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //LocalExpressions\>\""}], "]"}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "localExpressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<        \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"localExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
           "\"\< = \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"localExpressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "2"}], "]"}], "]"}], " ", "]"}], "]"}], ",", 
           "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";",
      "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"timeDelaysT1", "=", "timeDelays"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{
         "file", ",", 
          "\"\<        //Initializing variable vector for \
Newton-Raphson\>\""}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"If", "[", 
         RowBox[{
          RowBox[{"n", ">", "0"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"n", "=", 
            RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"i", "=", "1"}], ",", 
             RowBox[{"i", "<", 
              RowBox[{"n", "+", "1"}]}], ",", 
             RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        stateVark[\>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"i", "-", "1"}], "]"}], ",", "\"\<] = \>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"variables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\<;\>\""}], 
                "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{
            "file", ",", 
             "\"\<        //Iterative solution using Newton-Rapshson\>\""}], 
            "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{
            "file", ",", "\"\<        for(iter=1;iter<=mNoiter;iter++)\>\""}],
             "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "\"\<        {\>\""}], "]"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<         //\>\"", ",", 
               RowBox[{"ToString", "[", "displayName", "]"}]}], "]"}]}], 
            "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{
            "file", ",", 
             "\"\<         //Differential-algebraic system of equation \
parts\>\""}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{
             "StringJoin", "[", 
              "\"\<          //Assemble differential-algebraic equations\>\"",
               "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"n", "=", 
            RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"i", "=", "0"}], ",", 
             RowBox[{"i", "<", "n"}], ",", 
             RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{
              RowBox[{"WriteCode", "[", 
               RowBox[{"file", ",", 
                RowBox[{"StringJoin", "[", 
                 RowBox[{"\"\<          systemEquations[\>\"", ",", 
                  RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<] =\>\"", 
                  ",", 
                  RowBox[{"ToString", "[", 
                   RowBox[{"CForm", "[", 
                    RowBox[{"Gfunc", "[", 
                    RowBox[{"[", 
                    RowBox[{"i", "+", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
                  "\"\<;\>\""}], "]"}]}], "]"}], ";"}]}], 
            "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "\"\<          //Jacobian matrix\>\""}], 
            "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", " ", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"i", "=", "0"}], ",", 
             RowBox[{"i", "<", "n"}], ",", 
             RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", "\t\t ", 
             RowBox[{"For", "[", 
              RowBox[{
               RowBox[{"j", "=", "0"}], ",", 
               RowBox[{"j", "<", "n"}], ",", 
               RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", "\t\t\t", 
               RowBox[{"WriteCode", "[", 
                RowBox[{"file", ",", 
                 RowBox[{"StringJoin", "[", 
                  RowBox[{"\"\<          jacobianMatrix[\>\"", ",", 
                   RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<][\>\"", 
                   ",", 
                   RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<] = \>\"", 
                   ",", 
                   RowBox[{"ToString", "[", 
                    RowBox[{"CForm", " ", "[", 
                    RowBox[{"jacob", "[", 
                    RowBox[{"[", 
                    RowBox[{
                    RowBox[{"i", "+", "1"}], ",", 
                    RowBox[{"j", "+", "1"}]}], "]"}], "]"}], "]"}], "]"}], 
                   ",", "\"\<;\>\""}], "]"}]}], "]"}]}], 
              "\[IndentingNewLine]", "  ", "]"}]}], " ", 
            "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "AutoCodeAlert"}], "]"}], ";", 
           "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{
            "file", ",", 
             "\"\<          //Solving equation using LU-faktorisation\>\""}], 
            "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"WriteCode", "[", 
            RowBox[{
            "file", ",", 
             "\"\<          mpSolver->solve(jacobianMatrix, systemEquations, \
stateVark, iter);\>\""}], "]"}], ";", "\[IndentingNewLine]", 
           RowBox[{"(*", 
            RowBox[{
             RowBox[{"WriteCode", "[", 
              RowBox[{
              "file", ",", 
               "\"\<          ludcmp(jacobianMatrix, order);\>\""}], "]"}], 
             ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{
              "file", ",", 
               "\"\<          \
solvlu(jacobianMatrix,systemEquations,deltaStateVar,order);\>\""}], "]"}], 
             ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", 
             "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        for(i=0;i<\>\"", ",", 
                 RowBox[{"ToString", "[", "n", "]"}], ",", "\"\<;i++)\>\""}], 
                "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", "\"\<          {\>\""}], "]"}], ";", 
             "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{
              "file", ",", 
               "\"\<          stateVar[i] = stateVark[i] - \>\""}], "]"}], 
             ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{
              "file", ",", 
               "\"\<          jsyseqnweight[iter - 1] * \
deltaStateVar[i];\>\""}], "]"}], ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", "\"\<          }\>\""}], "]"}], ";", 
             "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        for(i=0;i<\>\"", ",", 
                 RowBox[{"ToString", "[", "n", "]"}], ",", "\"\<;i++)\>\""}], 
                "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", "\"\<          {\>\""}], "]"}], ";", 
             "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{
              "file", ",", "\"\<          stateVark[i] = stateVar[i];\>\""}], 
              "]"}], ";", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", "\"\<          }\>\""}], "]"}], ";"}], 
            "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", 
           RowBox[{"n", "=", 
            RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
           "\[IndentingNewLine]", 
           RowBox[{"For", "[", 
            RowBox[{
             RowBox[{"i", "=", "1"}], ",", 
             RowBox[{"i", "<", 
              RowBox[{"n", "+", "1"}]}], ",", 
             RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<          \>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"variables", "[", 
                   RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", 
                 "\"\<=stateVark[\>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"i", "-", "1"}], "]"}], ",", "\"\<];\>\""}], 
                "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], 
     ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "expressions", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<          //Expressions\>\""}], "]"}]}], 
      "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", 
         RowBox[{"StringJoin", "[", 
          RowBox[{"\"\<          \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"CForm", "[", 
             RowBox[{"expressions", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], "]"}], ",", 
           "\"\< = \>\"", ",", 
           RowBox[{"ToString", "[", 
            RowBox[{"OutputForm", "[", 
             RowBox[{"CForm", "[", 
              RowBox[{"expressions", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "2"}], "]"}], "]"}], "]"}], "]"}], "]"}], 
           ",", "\"\<;\>\""}], "]"}]}], "]"}]}], "\[IndentingNewLine]", "]"}],
      ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{"n", ">", "0"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", "\"\<        }\>\""}], "]"}], ";"}]}], 
      RowBox[{"(*", 
       RowBox[{
        RowBox[{
         RowBox[{"This", " ", "}"}], " ", "should", " ", "only", " ", "be", 
         " ", "used", " ", "if", " ", "Newton"}], "-", 
        RowBox[{"Raphson", " ", "solver", " ", "is", " ", "used"}]}], "*)"}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        //Calculate the delayed parts\>\""}], 
      "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{
            RowBox[{"delayOrder", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        \>\"", ",", 
               RowBox[{"delayExpressions", "[", 
                RowBox[{"[", 
                 RowBox[{"i", ",", "j"}], "]"}], "]"}]}], "]"}]}], "]"}], 
           ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ","}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", "2"}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        delayedPart[\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<][\>\"", ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", 
               "\"\<] = delayParts\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<[\>\"", ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<];\>\""}], 
              "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "2"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{
            RowBox[{"delayOrder", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"WriteCode", "[", 
            RowBox[{"file", ",", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<        delayedPart[\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", "\"\<][\>\"", ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", 
               "\"\<] = mDelayedPart\>\"", ",", 
               RowBox[{"ToString", "[", "i", "]"}], ",", 
               RowBox[{"ToString", "[", "j", "]"}], ",", "\"\<.getIdx(\>\"", 
               ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"j", "-", "2"}], "]"}], ",", "\"\<);\>\""}], "]"}]}], 
            "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<        //Write new values to nodes\>\"", 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"m", "=", 
         RowBox[{"Length", "[", 
          RowBox[{"nodeConnections", "[", 
           RowBox[{"[", 
            RowBox[{"i", ",", "6"}], "]"}], "]"}], "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        //Port P\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"nodeConnections", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], "]"}],
         ";", "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"j", "=", "1"}], ",", 
          RowBox[{"j", "<", 
           RowBox[{"m", "+", "1"}]}], ",", 
          RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{
           RowBox[{"If", "[", 
            RowBox[{
             RowBox[{
              RowBox[{"nodeConnections", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "6", ",", "j", ",", "6"}], "]"}], "]"}], 
              "\[Equal]", "\"\<out\>\""}], ",", "\[IndentingNewLine]", 
             "\[IndentingNewLine]", 
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        (*mpND_\>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}],
                   "]"}], ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
                 "\"\<)=\>\"", ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "6", ",", "j", ",", "1"}], "]"}], "]"}],
                   "]"}], ",", 
                 RowBox[{"ToString", "[", 
                  RowBox[{"nodeConnections", "[", 
                   RowBox[{"[", 
                    RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
                 "\"\<;\>\""}], "]"}]}], "]"}]}], "]"}], ";"}]}], 
         "\[IndentingNewLine]", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], 
     ";", "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "outputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<        //outputVariables\>\"", "]"}]}], "]"}],
      ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{"(*", 
        RowBox[{
         RowBox[{"WriteCode", "[", 
          RowBox[{"file", ",", 
           RowBox[{"StringJoin", "[", 
            RowBox[{"\"\<        //Port P\>\"", ",", 
             RowBox[{"ToString", "[", 
              RowBox[{"outputVariables", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}], 
          "]"}], ";"}], "*)"}], "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        (*mp\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<)=\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"outputVariables", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<;\>\""}], "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", 
      "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{
       "StringJoin", "[", "\"\<        //Update the delayed variabels\>\"", 
        "]"}]}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"If", "[", 
      RowBox[{
       RowBox[{
        RowBox[{"Depth", "[", "systemEquationsDa", "]"}], ">", "1"}], ",", 
       "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"n", "=", 
         RowBox[{"Length", "[", "systemEquations", "]"}]}], ";", 
        "\[IndentingNewLine]", 
        RowBox[{"For", "[", 
         RowBox[{
          RowBox[{"i", "=", "1"}], ",", 
          RowBox[{"i", "<", 
           RowBox[{"n", "+", "1"}]}], ",", 
          RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
          RowBox[{"For", "[", 
           RowBox[{
            RowBox[{"j", "=", "1"}], ",", 
            RowBox[{"j", "<", 
             RowBox[{
              RowBox[{"delayOrder", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "+", "1"}]}], ",", 
            RowBox[{"j", "++"}], ",", "\[IndentingNewLine]", 
            RowBox[{
             RowBox[{"WriteCode", "[", 
              RowBox[{"file", ",", 
               RowBox[{"StringJoin", "[", 
                RowBox[{"\"\<        mDelayedPart\>\"", ",", 
                 RowBox[{"ToString", "[", "i", "]"}], ",", 
                 RowBox[{"ToString", "[", "j", "]"}], ",", 
                 "\"\<.update(delayParts\>\"", ",", 
                 RowBox[{"ToString", "[", " ", "i", "]"}], ",", "\"\<[\>\"", 
                 ",", 
                 RowBox[{"ToString", "[", " ", "j", "]"}], ",", 
                 "\"\<]);\>\""}], "]"}]}], "]"}], ";"}]}], 
           "\[IndentingNewLine]", "]"}]}], "\[IndentingNewLine]", "]"}], 
        ";"}]}], "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"(*", " ", 
      RowBox[{
       RowBox[{"WriteCode", "[", 
        RowBox[{"file", ",", "\"\<        //Initialize delays\>\""}], "]"}], 
       ";"}], " ", "*)"}], "\[IndentingNewLine]", 
     RowBox[{"(*", 
      RowBox[{"delay", ".", "initialize"}], "*)"}], "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "stepDelays", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", "\"\<mDelay\>\"", "]"}], ",", 
            RowBox[{"ToString", "[", 
             RowBox[{
              RowBox[{"stepDelayVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\<.update(\>\"", 
            ",", 
            RowBox[{"ToString", "[", 
             RowBox[{
              RowBox[{"stepDelayVariables", "[", 
               RowBox[{"[", "i", "]"}], "]"}], "[", 
              RowBox[{"[", "1", "]"}], "]"}], "]"}], ",", "\"\<);\>\""}], 
           "]"}]}], "]"}], ";"}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "timeDelaysT1", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"WriteCode", "[", 
         RowBox[{"file", ",", 
          RowBox[{"StringJoin", "[", 
           RowBox[{"\"\<        \>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{"timeDelaysT1", "[", 
              RowBox[{"[", 
               RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}], ",", 
            "\"\<.update(\>\"", ",", 
            RowBox[{"ToString", "[", 
             RowBox[{
              RowBox[{"timeDelaysT1", "[", 
               RowBox[{"[", 
                RowBox[{"i", ",", "3"}], "]"}], "]"}], "-", "1"}], "]"}], 
            ",", "\"\<);\>\""}], "]"}]}], "]"}], ";"}]}], 
      "\[IndentingNewLine]", "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<     }\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<    void deconfigure()\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<    {\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<        delete mpSolver;\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<    }\>\""}], "]"}], ";", 
     "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", "\"\<};\>\""}], "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"WriteCode", "[", 
      RowBox[{"file", ",", 
       RowBox[{"StringJoin", "[", 
        RowBox[{"\"\<#endif // \>\"", ",", 
         RowBox[{"ToUpperCase", "[", "componentName", "]"}], ",", 
         "\"\<_HPP_INCLUDED\>\""}], "]"}]}], "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputParameters", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"ToExpression", "[", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
           RowBox[{"ToString", "[", 
            RowBox[{"inputParNames0", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\<=.;\>\""}], 
          "]"}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"inputParameters", "[", 
          RowBox[{"[", 
           RowBox[{"i", ",", "1"}], "]"}], "]"}], "=", 
         RowBox[{"Symbol", "[", 
          RowBox[{"inputParNames0", "[", 
           RowBox[{"[", "i", "]"}], "]"}], "]"}]}]}]}], "\[IndentingNewLine]",
       "]"}], ";", "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"ToExpression", "[", 
         RowBox[{"StringJoin", "[", 
          RowBox[{
           RowBox[{"ToString", "[", 
            RowBox[{"inputVarNames0", "[", 
             RowBox[{"[", "i", "]"}], "]"}], "]"}], ",", "\"\<=.;\>\""}], 
          "]"}], "]"}], ";", "\[IndentingNewLine]", 
        RowBox[{
         RowBox[{"inputVariables", "[", 
          RowBox[{"[", 
           RowBox[{"i", ",", "1"}], "]"}], "]"}], "=", 
         RowBox[{"Symbol", "[", 
          RowBox[{"inputVarNames0", "[", 
           RowBox[{"[", "i", "]"}], "]"}], "]"}]}]}]}], "\[IndentingNewLine]",
       "]"}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", 
     RowBox[{"Close", "[", "file", "]"}], ";", "\[IndentingNewLine]", 
     "\[IndentingNewLine]", 
     RowBox[{"n", "=", 
      RowBox[{"Length", "[", "nodeConnections", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"niv", "=", 
      RowBox[{"Length", "[", "inputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"nov", "=", 
      RowBox[{"Length", "[", "outputVariables", "]"}]}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"ntot", "=", 
      RowBox[{"n", "+", "niv", "+", "nov"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"ports", "=", 
      RowBox[{"Array", "[", 
       RowBox[{"a", ",", "ntot"}], "]"}]}], ";", "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"n", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"ports", "[", 
         RowBox[{"[", "i", "]"}], "]"}], "=", 
        RowBox[{"XMLElement", "[", 
         RowBox[{"\"\<portpose\>\"", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"\"\<x\>\"", "->", "\"\<0\>\""}], ",", 
            RowBox[{"\"\<y\>\"", "\[Rule]", 
             FractionBox["i", 
              RowBox[{"n", "+", "1."}]]}], ",", 
            RowBox[{"\"\<a\>\"", "->", "\"\<0\>\""}], ",", 
            RowBox[{"\"\<name\>\"", "\[Rule]", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<P\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"nodeConnections", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}]}], 
           "}"}], ",", 
          RowBox[{"{", "}"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"niv", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"ports", "[", 
         RowBox[{"[", 
          RowBox[{"n", "+", "i"}], "]"}], "]"}], "=", 
        RowBox[{"XMLElement", "[", 
         RowBox[{"\"\<portpose\>\"", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"\"\<x\>\"", "->", 
             FractionBox["i", 
              RowBox[{"niv", "+", "1."}]]}], ",", 
            RowBox[{"\"\<y\>\"", "->", "\"\<0\>\""}], ",", 
            RowBox[{"\"\<a\>\"", "->", "\"\<270\>\""}], ",", 
            RowBox[{"\"\<name\>\"", "\[Rule]", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"inputVariables", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}]}], 
           "}"}], ",", 
          RowBox[{"{", "}"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"For", "[", 
      RowBox[{
       RowBox[{"i", "=", "1"}], ",", 
       RowBox[{"i", "<", 
        RowBox[{"nov", "+", "1"}]}], ",", 
       RowBox[{"i", "++"}], ",", "\[IndentingNewLine]", 
       RowBox[{
        RowBox[{"ports", "[", 
         RowBox[{"[", 
          RowBox[{"n", "+", "niv", "+", "i"}], "]"}], "]"}], "=", 
        RowBox[{"XMLElement", "[", 
         RowBox[{"\"\<portpose\>\"", ",", 
          RowBox[{"{", 
           RowBox[{
            RowBox[{"\"\<x\>\"", "\[Rule]", " ", 
             RowBox[{"ToString", "[", 
              FractionBox["i", 
               RowBox[{"nov", "+", "1."}]], "]"}]}], ",", 
            RowBox[{"\"\<y\>\"", "->", "\"\<1\>\""}], ",", 
            RowBox[{"\"\<a\>\"", "->", "\"\<90\>\""}], ",", 
            RowBox[{"\"\<name\>\"", "\[Rule]", 
             RowBox[{"StringJoin", "[", 
              RowBox[{"\"\<\>\"", ",", 
               RowBox[{"ToString", "[", 
                RowBox[{"outputVariables", "[", 
                 RowBox[{"[", 
                  RowBox[{"i", ",", "1"}], "]"}], "]"}], "]"}]}], "]"}]}]}], 
           "}"}], ",", 
          RowBox[{"{", "}"}]}], "]"}]}]}], "\[IndentingNewLine]", "]"}], ";", 
     "\[IndentingNewLine]", 
     RowBox[{"Export", "[", 
      RowBox[{"XMLName", ",", 
       RowBox[{"XMLElement", "[", 
        RowBox[{"\"\<hopsanobjectappearance\>\"", ",", 
         RowBox[{"{", 
          RowBox[{"\"\<version\>\"", "->", "\"\<0.1\>\""}], "}"}], ",", 
         "\[IndentingNewLine]", 
         RowBox[{"XMLElement", "[", 
          RowBox[{"\"\<modelobject\>\"", ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{"\"\<typename\>\"", "->", "componentName"}], ",", 
             RowBox[{"\"\<displayname\>\"", "\[Rule]", "componentName"}]}], 
            "}"}], ",", 
           RowBox[{"{", 
            RowBox[{
             RowBox[{"XMLElement", "[", 
              RowBox[{"\"\<icon\>\"", ",", 
               RowBox[{"{", 
                RowBox[{
                 RowBox[{"\"\<isopath\>\"", "\[Rule]", "svgName"}], ",", " ", 
                 RowBox[{"\"\<iconrotation\>\"", "\[Rule]", "\"\<ON\>\""}], 
                 ",", 
                 RowBox[{"\"\<userpath\>\"", "\[Rule]", "svgName"}]}], "}"}], 
               ",", 
               RowBox[{"{", "}"}]}], "]"}], ",", 
             RowBox[{"XMLElement", "[", 
              RowBox[{"\"\<portpositions\>\"", ",", 
               RowBox[{"{", "}"}], ",", "ports"}], "]"}]}], "}"}]}], "]"}]}], 
        "]"}], ",", "\"\<XML\>\""}], "]"}], ";"}]}], "\[IndentingNewLine]", 
   "]"}]}]], "Input",
 CellChangeTimes->{{3.4874786272895985`*^9, 3.487478647492206*^9}, {
   3.4874786870068197`*^9, 3.4874788014897194`*^9}, {3.4874788931315174`*^9, 
   3.487478918881847*^9}, {3.4874790792588997`*^9, 3.487479099368108*^9}, {
   3.487479133633075*^9, 3.487479194006916*^9}, {3.4991082380625*^9, 
   3.49910824075*^9}, {3.4996017277128663`*^9, 3.4996017396346655`*^9}, 
   3.499601786212492*^9, {3.4997074871875*^9, 3.499707488609375*^9}, {
   3.4997085431875*^9, 3.49970854540625*^9}, {3.49970869671875*^9, 
   3.499708714109375*^9}, {3.499712610453125*^9, 3.4997126108125*^9}, {
   3.4997502686230717`*^9, 3.4997502840604725`*^9}, {3.499750417418994*^9, 
   3.4997504895747824`*^9}, {3.4997505323401337`*^9, 3.499750578824211*^9}, {
   3.499750617011467*^9, 3.49975061721459*^9}, {3.4997511468518257`*^9, 
   3.4997511614611073`*^9}, {3.4997513328193855`*^9, 3.499751338084977*^9}, {
   3.499751380444081*^9, 3.499751386506542*^9}, 3.4997514293656425`*^9, {
   3.499751465724785*^9, 3.499751475709096*^9}, {3.4997515189588194`*^9, 
   3.499751553317974*^9}, {3.499766175671875*^9, 3.4997661855625*^9}, 
   3.499766258421875*^9, {3.499766362921875*^9, 3.499766365859375*^9}, {
   3.499767232856484*^9, 3.4997672375040884`*^9}, {3.499767268190797*^9, 
   3.499767286280463*^9}, 3.499767338030052*^9, 3.49976741306461*^9, {
   3.4997677758197784`*^9, 3.499767781570919*^9}, {3.499768817882579*^9, 
   3.4997688223669825`*^9}, {3.499769313523591*^9, 3.499769313601716*^9}, {
   3.5019962178800926`*^9, 3.5019962342705755`*^9}, 3.5019964302849464`*^9, 
   3.502001723778649*^9, {3.5020017750755234`*^9, 3.5020017763255234`*^9}, {
   3.5020073474857054`*^9, 3.5020073855941525`*^9}, 3.5037289432532654`*^9, 
   3.503729209939059*^9, 3.5037292494075565`*^9, {3.5037309509146905`*^9, 
   3.5037309696644506`*^9}, {3.5037311659287252`*^9, 3.503731171241191*^9}, {
   3.5037316598474393`*^9, 3.5037316713786154`*^9}, {3.5037322482000837`*^9, 
   3.5037322490750556`*^9}, {3.503732286339488*^9, 3.5037323195571747`*^9}, {
   3.503732350618681*^9, 3.5037323973828096`*^9}, {3.503732431053607*^9, 
   3.5037324577093287`*^9}, {3.503739509424355*^9, 3.5037395101279297`*^9}, {
   3.5039027109738884`*^9, 3.5039027260828767`*^9}, {3.503902756378976*^9, 
   3.503902762238201*^9}, {3.5039028026902905`*^9, 3.5039028077682858`*^9}, {
   3.5039029513118677`*^9, 3.5039029633117905`*^9}, {3.5039038518344383`*^9, 
   3.503903929725063*^9}, {3.5039039771156883`*^9, 3.5039039781781883`*^9}, {
   3.503904064662504*^9, 3.503904076286909*^9}, {3.503904119769058*^9, 
   3.5039041422522817`*^9}, {3.50390462690777*^9, 3.5039046278452525`*^9}, {
   3.5039053399175425`*^9, 3.5039053416206455`*^9}, {3.503910457868247*^9, 
   3.5039104588995037`*^9}, {3.5039129132231216`*^9, 
   3.5039129137387433`*^9}, {3.5039131112532063`*^9, 
   3.5039131412530146`*^9}, {3.503914295271106*^9, 3.5039143621601067`*^9}, {
   3.50391502826573*^9, 3.50391503742198*^9}, {3.503915287531355*^9, 
   3.50391531020323*^9}, {3.503920468404045*^9, 3.5039205111222486`*^9}, {
   3.5039208453998632`*^9, 3.5039208841964903`*^9}, {3.503921595552404*^9, 
   3.5039215997554483`*^9}, 3.5039217498463163`*^9, 3.503921926438693*^9, {
   3.503922044266064*^9, 3.503922046000428*^9}, {3.50393963834375*^9, 
   3.503939639828125*^9}, {3.503940132890625*^9, 3.50394020421875*^9}, {
   3.503940236109375*^9, 3.50394029715625*^9}, {3.503940530375*^9, 
   3.50394055446875*^9}, {3.5039405920625*^9, 3.50394059359375*^9}, {
   3.503940731109375*^9, 3.50394073771875*^9}, {3.5039407806875*^9, 
   3.50394079525*^9}, {3.503940972921875*^9, 3.5039410423125*^9}, 
   3.503942035125*^9, {3.503942122375*^9, 3.503942146703125*^9}, 
   3.503942292375*^9, 3.503943147859375*^9, {3.503943192203125*^9, 
   3.50394320653125*^9}, 3.503943278046875*^9, {3.5039433560625*^9, 
   3.503943377171875*^9}, {3.50394343690625*^9, 3.503943443078125*^9}, 
   3.503943563421875*^9, {3.5039437464375*^9, 3.503943752078125*^9}, {
   3.503943838765625*^9, 3.503943843609375*^9}, {3.503943999625*^9, 
   3.503944013140625*^9}, {3.50399490446896*^9, 3.50399491368771*^9}, 
   3.50399533346896*^9, {3.503995386297085*^9, 3.50399540337521*^9}, {
   3.503995529953335*^9, 3.50399557418771*^9}, {3.50399566840646*^9, 
   3.50399567525021*^9}, {3.5039995313697*^9, 3.503999536135295*^9}, 
   3.504103954734375*^9, {3.504104319578125*^9, 3.504104332015625*^9}, {
   3.504104465859375*^9, 3.504104698984375*^9}, 3.50410485240625*^9, {
   3.504104997640625*^9, 3.50410501390625*^9}, {3.504105360203125*^9, 
   3.504105364359375*^9}, {3.504119790546875*^9, 3.504119831234375*^9}, {
   3.50412004653125*^9, 3.5041200505*^9}, {3.5041202105*^9, 
   3.5041202116875*^9}, {3.504121347125*^9, 3.50412134796875*^9}, {
   3.504161224234375*^9, 3.5041612288125*^9}, {3.504161535296875*^9, 
   3.5041615686875*^9}, {3.504194659953125*^9, 3.50419470071875*^9}, {
   3.50419756234375*^9, 3.504197567359375*^9}, {3.504198927859375*^9, 
   3.5041989493125*^9}, {3.504199014015625*^9, 3.50419901421875*^9}, {
   3.504199077546875*^9, 3.504199082609375*^9}, {3.5042381836740313`*^9, 
   3.504238185350623*^9}, {3.504238250551423*^9, 3.504238252290111*^9}, {
   3.5042383047281895`*^9, 3.5042383323200116`*^9}, {3.5042385432337694`*^9, 
   3.5042385671310935`*^9}, {3.5042424845209093`*^9, 
   3.5042425054426503`*^9}, {3.5042426230356474`*^9, 3.504242627660618*^9}, {
   3.5042426941914425`*^9, 3.5042426968476753`*^9}, {3.5042427519566975`*^9, 
   3.504242760409768*^9}, {3.5042428670653358`*^9, 3.5042429617366047`*^9}, {
   3.5042430928138657`*^9, 3.5042430985169177`*^9}, {3.5042431572974153`*^9, 
   3.5042431971406555`*^9}, {3.5042433662634907`*^9, 3.504243368232215*^9}, {
   3.5042434348563623`*^9, 3.5042434364500923`*^9}, 3.5042434750120983`*^9, 
   3.5042448967436857`*^9, {3.504244928118485*^9, 3.5042449502433434`*^9}, {
   3.5042450505864515`*^9, 3.504245062961372*^9}, {3.504254367049516*^9, 
   3.504254373283976*^9}, {3.504254425409977*^9, 3.504254455738684*^9}, {
   3.5042544932550297`*^9, 3.5042545185680156`*^9}, {3.5042546223512583`*^9, 
   3.504254699961725*^9}, 3.504266965054522*^9, 3.50426751031956*^9, {
   3.504268035307144*^9, 3.5042680423693275`*^9}, {3.504268254317979*^9, 
   3.5042683040045247`*^9}, {3.5042683537066956`*^9, 3.5042683538004436`*^9}, 
   3.504268665220315*^9, {3.5042688538462324`*^9, 3.504268885237259*^9}, {
   3.5042689979730773`*^9, 3.5042689987074614`*^9}, {3.50427064642728*^9, 
   3.5042706474429045`*^9}, {3.50427078489603*^9, 3.50427079608353*^9}, {
   3.504270995347041*^9, 3.504270998347003*^9}, {3.504325086390299*^9, 
   3.504325145881885*^9}, {3.5043251938377934`*^9, 3.504325232571411*^9}, {
   3.50432526928863*^9, 3.5043253453707504`*^9}, {3.504325611267085*^9, 
   3.5043256436593685`*^9}, {3.504325676082904*^9, 3.504325714334862*^9}, {
   3.504325797510996*^9, 3.504325866717664*^9}, {3.5043297446393323`*^9, 
   3.5043297513268323`*^9}, {3.504343564625*^9, 3.504343610984375*^9}, 
   3.504343790890625*^9, 3.5043438483125*^9, 3.50559017859375*^9, 
   3.50559043946875*^9, {3.5058191126986294`*^9, 3.505819157495218*^9}, {
   3.5058217045312324`*^9, 3.5058217080311203`*^9}, {3.5058224025960555`*^9, 
   3.5058224185939054`*^9}, {3.505822810924694*^9, 3.505822823501933*^9}, {
   3.505977166625*^9, 3.505977170515625*^9}, {3.5059772419375*^9, 
   3.5059772475*^9}, {3.507794322609375*^9, 3.50779432371875*^9}, 
   3.5077944528125*^9, 3.507794503328125*^9, {3.507795373625*^9, 
   3.50779541290625*^9}, {3.507795447796875*^9, 3.507795469453125*^9}, {
   3.507795748796875*^9, 3.50779576753125*^9}, 3.50779609475*^9, {
   3.511364115828125*^9, 3.511364115953125*^9}, {3.511367817734375*^9, 
   3.511367828921875*^9}, {3.51136791990625*^9, 3.51136797115625*^9}, {
   3.51136800215625*^9, 3.511368122125*^9}, {3.511368254078125*^9, 
   3.511368262203125*^9}, {3.511368459453125*^9, 3.511368466171875*^9}, {
   3.511376442390625*^9, 3.511376692265625*^9}, {3.511376735046875*^9, 
   3.5113767470625*^9}, 3.51137710346875*^9, {3.511377133484375*^9, 
   3.51137714178125*^9}, {3.511377800140625*^9, 3.511377801265625*^9}, {
   3.511377937296875*^9, 3.511377962390625*^9}, {3.51137819534375*^9, 
   3.511378198359375*^9}, {3.51137825171875*^9, 3.511378257671875*^9}, {
   3.5113784198125*^9, 3.51137841996875*^9}, 3.511378567546875*^9, 
   3.511378629640625*^9, 3.511378698765625*^9, {3.511415864671875*^9, 
   3.511415944015625*^9}, 3.511416171984375*^9, {3.511416243703125*^9, 
   3.511416286421875*^9}, 3.511416436125*^9, {3.51141662515625*^9, 
   3.511416672578125*^9}, {3.5115102416983023`*^9, 3.5115103712599735`*^9}, {
   3.511510605275435*^9, 3.51151060750981*^9}, {3.51151068238481*^9, 
   3.511510690306685*^9}, {3.511510769337935*^9, 3.51151078635356*^9}, {
   3.511510843150435*^9, 3.511510856744185*^9}, {3.511510925587935*^9, 
   3.51151092847856*^9}, {3.51151098907231*^9, 3.51151099397856*^9}, {
   3.51151103713481*^9, 3.51151104766606*^9}, {3.51151108810356*^9, 
   3.51151108904106*^9}, {3.511511411619185*^9, 3.511511412306685*^9}, {
   3.511511445744185*^9, 3.51151144641606*^9}, {3.511511569400435*^9, 
   3.511511607775435*^9}, {3.511511683587935*^9, 3.51151169035356*^9}, 
   3.511511780806685*^9, {3.511511841494185*^9, 3.511511868087981*^9}, {
   3.511517478487205*^9, 3.51151749344033*^9}, {3.511517572643455*^9, 
   3.511517578330955*^9}, {3.511517610330955*^9, 3.51151767528408*^9}, {
   3.51151779262783*^9, 3.51151779569033*^9}, {3.511518018518455*^9, 
   3.511518020705955*^9}, 3.5121831699939404`*^9, 3.512184589936625*^9, 
   3.51223080090625*^9, {3.512805344564395*^9, 3.5128053688667793`*^9}, {
   3.512805891694397*^9, 3.5128060221056213`*^9}, {3.5128178492267065`*^9, 
   3.5128178732901306`*^9}, {3.5128179097759066`*^9, 3.512817914291705*^9}, {
   3.5128179796379642`*^9, 3.512818094485308*^9}, {3.5128181409856057`*^9, 
   3.512818148251277*^9}, 3.5128182854084053`*^9, {3.512818536624182*^9, 
   3.512818537577301*^9}, {3.5128186004831486`*^9, 3.5128186401860194`*^9}, {
   3.512832087734375*^9, 3.512832113609375*^9}, 3.5128321611875*^9, {
   3.51292157978125*^9, 3.512921591359375*^9}, {3.513073897219201*^9, 
   3.513073973305603*^9}, 3.51310524134375*^9, {3.51323275978125*^9, 
   3.51323278609375*^9}, 3.513246884953125*^9, {3.5133126169177437`*^9, 
   3.5133126302146187`*^9}, 3.5133126621052437`*^9, {3.513315958282009*^9, 
   3.5133159868917503`*^9}, {3.5133160169858856`*^9, 3.513316018329653*^9}, {
   3.5133160652208776`*^9, 3.513316072236593*^9}, {3.5133162452700577`*^9, 
   3.513316332502471*^9}, {3.51331647471667*^9, 3.5133164854507017`*^9}, {
   3.513320627437153*^9, 3.5133207893913145`*^9}, {3.5133208325009656`*^9, 
   3.5133208512510853`*^9}, 3.513320908329576*^9, 3.5133210085645924`*^9, {
   3.513321207487247*^9, 3.5133212138151693`*^9}, {3.5133330776053376`*^9, 
   3.5133330778709526`*^9}, {3.513395162302904*^9, 3.5133952503532243`*^9}, 
   3.5133953446999073`*^9, {3.5133955455142164`*^9, 3.513395569612991*^9}, {
   3.513404773902603*^9, 3.513404774293316*^9}, {3.513860973546875*^9, 
   3.513860975375*^9}, {3.5138610388125*^9, 3.513861100171875*^9}, {
   3.513861292*^9, 3.5138613033125*^9}, {3.5139345999939833`*^9, 
   3.513934640790597*^9}, {3.513936814235764*^9, 3.513936828907639*^9}, {
   3.513936887079514*^9, 3.513936946798264*^9}, {3.513937033798264*^9, 
   3.513937036454514*^9}, {3.513938701174657*^9, 3.5139387106117945`*^9}, {
   3.514002448529464*^9, 3.5140024774511538`*^9}, {3.5140025577318897`*^9, 
   3.514002569684938*^9}, 3.5140082985975904`*^9, 3.515610049453125*^9, {
   3.515610861546875*^9, 3.51561088303125*^9}, 3.51561131096875*^9, {
   3.5156121305625*^9, 3.515612186140625*^9}, {3.515612845546875*^9, 
   3.515612921*^9}, {3.515613360515625*^9, 3.515613372171875*^9}, {
   3.51561347059375*^9, 3.515613482765625*^9}, 3.51561353775*^9, {
   3.515613659125*^9, 3.515613696109375*^9}, {3.515613774875*^9, 
   3.515613810140625*^9}, {3.5156138646875*^9, 3.51561387334375*^9}, 
   3.5156139134375*^9, {3.515676354734375*^9, 3.515676361671875*^9}, {
   3.515676420578125*^9, 3.515676447125*^9}, {3.51567770575*^9, 
   3.515677724640625*^9}, 3.515677792390625*^9, {3.5156819838125*^9, 
   3.51568198703125*^9}, {3.51568205840625*^9, 3.51568206009375*^9}, {
   3.515682382703125*^9, 3.515682448*^9}, {3.5156825003125*^9, 
   3.5156825489375*^9}, {3.51568258115625*^9, 3.51568258190625*^9}, {
   3.515685898328125*^9, 3.51568592640625*^9}, 3.51568604521875*^9, 
   3.515686104328125*^9, {3.5156863896875*^9, 3.515686393609375*^9}, {
   3.515686526765625*^9, 3.5156865299375*^9}, {3.5157261673656263`*^9, 
   3.515726167693117*^9}, {3.5157313070994997`*^9, 3.5157313078963747`*^9}, 
   3.5157349348768435`*^9, {3.515735172761875*^9, 3.5157352207293973`*^9}, {
   3.515735265759715*^9, 3.51573536185285*^9}, 3.515735393946395*^9, {
   3.51577641228125*^9, 3.515776435359375*^9}, {3.51577647084375*^9, 
   3.5157764791875*^9}, 3.515776555734375*^9, {3.5158125495066767`*^9, 
   3.5158125507402534`*^9}, 3.515812615073642*^9, {3.5158126489267445`*^9, 
   3.5158126645884895`*^9}, {3.5158127789364023`*^9, 3.5158127849012938`*^9}, 
   3.51582165531431*^9, {3.51582169272056*^9, 3.5158217254076953`*^9}, {
   3.515822051606995*^9, 3.5158220676381426`*^9}, {3.515822203777896*^9, 
   3.5158222384182997`*^9}, {3.515822842651623*^9, 3.515822849714078*^9}, {
   3.515822978885126*^9, 3.5158230376816244`*^9}, {3.5158231917743883`*^9, 
   3.5158231919618874`*^9}, {3.5160321185*^9, 3.51603211915625*^9}, {
   3.51608911240625*^9, 3.51608911821875*^9}, {3.516089322359375*^9, 
   3.516089328859375*^9}, {3.51608943584375*^9, 3.5160894385625*^9}, {
   3.5166862963783584`*^9, 3.516686335831736*^9}, {3.516686396097747*^9, 
   3.5166864743638725`*^9}, {3.5166870273672867`*^9, 
   3.5166870421956015`*^9}, {3.5166876914306493`*^9, 3.516687741884097*^9}, {
   3.516687778618707*^9, 3.5166878091345277`*^9}, {3.516687851259797*^9, 
   3.516687853119184*^9}, 3.516687993370368*^9, {3.516688115684434*^9, 
   3.5166881289814787`*^9}, {3.5166881698726273`*^9, 3.516688180294636*^9}, 
   3.5166882336234436`*^9, {3.516688359734313*^9, 3.516688487450471*^9}, {
   3.5166886491192417`*^9, 3.516688753493617*^9}, 3.5166888276342416`*^9, 
   3.5166888768217416`*^9, {3.516688955118617*^9, 3.516688958712367*^9}, 
   3.516689013696947*^9, {3.516698802992704*^9, 3.5166988041177254`*^9}, {
   3.516699286513763*^9, 3.516699348373138*^9}, {3.5167168150625*^9, 
   3.516716855671875*^9}, {3.516716896125*^9, 3.516716929109375*^9}, {
   3.51671705953125*^9, 3.51671706378125*^9}, {3.516818745578125*^9, 
   3.516818747875*^9}, {3.51681881475*^9, 3.516818825421875*^9}, {
   3.51681888778125*^9, 3.5168189059375*^9}, {3.516819038109375*^9, 
   3.51681904909375*^9}, {3.516853035453125*^9, 3.516853048515625*^9}, 
   3.516860270859375*^9, {3.516860461734375*^9, 3.51686057040625*^9}, {
   3.5168606599375*^9, 3.516860667984375*^9}, 3.5168607705625*^9, 
   3.516860991484375*^9, 3.516861027125*^9, 3.51686111796875*^9, {
   3.51686595553125*^9, 3.516866128046875*^9}, 3.5170379599406967`*^9, {
   3.517038026176343*^9, 3.5170380307076797`*^9}, {3.5175691673860416`*^9, 
   3.517569185944146*^9}, {3.5175704116869993`*^9, 3.5175704134737315`*^9}, {
   3.5175710177707596`*^9, 3.5175711233460703`*^9}, {3.517571229888817*^9, 
   3.517571232104556*^9}, {3.5176263453550754`*^9, 3.5176263798129444`*^9}, {
   3.5176264595261545`*^9, 3.5176264950118318`*^9}, 3.5176273351119494`*^9, {
   3.51763107609671*^9, 3.517631084767642*^9}, 3.517631152494647*^9, {
   3.517643494444738*^9, 3.517643496413602*^9}, {3.5176435339782653`*^9, 
   3.5176435365409126`*^9}, 3.5176435698391423`*^9, {3.517643601370594*^9, 
   3.517643822872012*^9}, {3.5176439056685176`*^9, 3.5176439064028835`*^9}, {
   3.517644021120165*^9, 3.5176440819943857`*^9}, 3.517644150181013*^9, 
   3.5176442101014643`*^9, 3.517644259272081*^9, 3.5176447189127083`*^9, 
   3.518253641703125*^9, {3.51834647590625*^9, 3.518346497640625*^9}, {
   3.51834659378125*^9, 3.51834662553125*^9}, {3.518547604390625*^9, 
   3.518547605125*^9}, 3.51854765921875*^9, {3.518547726875*^9, 
   3.518547752625*^9}, 3.51858899609375*^9, {3.518589082453125*^9, 
   3.51858918721875*^9}, {3.518612779203125*^9, 3.51861279646875*^9}, {
   3.5186128589375*^9, 3.51861288021875*^9}, {3.518612910734375*^9, 
   3.5186129294375*^9}, {3.51861302078125*^9, 3.5186130581875*^9}, {
   3.51861370103125*^9, 3.518613725484375*^9}, {3.5186138861875*^9, 
   3.51861389184375*^9}, {3.5186140546875*^9, 3.51861405534375*^9}, {
   3.518614298390625*^9, 3.51861429928125*^9}, {3.518627178046875*^9, 
   3.518627207328125*^9}, {3.51862724653125*^9, 3.5186273033125*^9}, 
   3.518627342375*^9, 3.518627394421875*^9, 3.518627455875*^9, {
   3.51862753665625*^9, 3.518627558*^9}, {3.518627700359375*^9, 
   3.518627736125*^9}, {3.518627811390625*^9, 3.518627890703125*^9}, 
   3.51862792746875*^9, {3.518629644234375*^9, 3.5186296550625*^9}, {
   3.518629781421875*^9, 3.518629913234375*^9}, {3.518629945109375*^9, 
   3.51863001390625*^9}, {3.518630235125*^9, 3.51863024009375*^9}, {
   3.518630373359375*^9, 3.518630379390625*^9}, {3.518630717921875*^9, 
   3.5186307214375*^9}, {3.518630767453125*^9, 3.51863077321875*^9}, 
   3.51863088671875*^9, 3.518630932921875*^9, {3.51863101196875*^9, 
   3.518631043609375*^9}, {3.518631107171875*^9, 3.51863112340625*^9}, {
   3.518631268625*^9, 3.518631269359375*^9}, {3.51863649496875*^9, 
   3.518636502109375*^9}, {3.518680294296875*^9, 3.518680418546875*^9}, {
   3.5186805480625*^9, 3.518680603078125*^9}, 3.51868069546875*^9, {
   3.518790458953125*^9, 3.518790516140625*^9}, {3.5187905474375*^9, 
   3.51879054928125*^9}, {3.518791565484375*^9, 3.5187916155*^9}, {
   3.518791854421875*^9, 3.518791876171875*^9}, {3.51879575103125*^9, 
   3.5187957545625*^9}, {3.518796171796875*^9, 3.51879617259375*^9}, {
   3.518798755671875*^9, 3.51879891503125*^9}, {3.518798949109375*^9, 
   3.5187989940625*^9}, {3.51884316406688*^9, 3.5188432185353117`*^9}, {
   3.518844251175878*^9, 3.5188442554728355`*^9}, {3.519152653359375*^9, 
   3.51915289953125*^9}, {3.51915293278125*^9, 3.519152995015625*^9}, {
   3.519153135875*^9, 3.519153184125*^9}, {3.519153731546875*^9, 
   3.519153744765625*^9}, {3.519153817546875*^9, 3.519153826515625*^9}, {
   3.51915411253125*^9, 3.519154120578125*^9}, {3.519154190703125*^9, 
   3.51915419634375*^9}, {3.519154249890625*^9, 3.519154261625*^9}, {
   3.5191543076875*^9, 3.519154319421875*^9}, 3.51915456390625*^9, {
   3.519154627453125*^9, 3.51915464146875*^9}, {3.5191546996875*^9, 
   3.519154701609375*^9}, 3.519154777625*^9, {3.51915497028125*^9, 
   3.51915498021875*^9}, {3.519237647109375*^9, 3.519237654109375*^9}, 
   3.5192377505*^9, 3.519238665453125*^9, {3.519238723859375*^9, 
   3.5192387281875*^9}, {3.519403868875*^9, 3.51940387728125*^9}, {
   3.51940414665625*^9, 3.519404146859375*^9}, 3.519404453296875*^9, {
   3.51980548578125*^9, 3.51980556053125*^9}, {3.519805924984375*^9, 
   3.519805925609375*^9}, {3.5198139488125*^9, 3.51981394909375*^9}, {
   3.519813991875*^9, 3.519813992921875*^9}, 3.520834674171875*^9, 
   3.521967974515625*^9, {3.52197052178125*^9, 3.521970532671875*^9}, {
   3.522517496984375*^9, 3.522517522296875*^9}, {3.522517568*^9, 
   3.5225175795625*^9}, {3.522517649671875*^9, 3.522517653078125*^9}, {
   3.522517830953125*^9, 3.52251790621875*^9}, {3.52251805453125*^9, 
   3.52251805946875*^9}, {3.522518907109375*^9, 3.5225189404375*^9}, {
   3.5225629448020453`*^9, 3.5225631092146087`*^9}, {3.522563171388637*^9, 
   3.522563175044934*^9}, {3.522563252841004*^9, 3.5225633153245792`*^9}, {
   3.522650621625*^9, 3.522650626203125*^9}, {3.52265069625*^9, 
   3.52265070209375*^9}, {3.5248123323056817`*^9, 3.5248123676190853`*^9}, {
   3.5294018787172947`*^9, 3.5294018816862917`*^9}, 3.5294041609313745`*^9, {
   3.529405735169879*^9, 3.5294057623278666`*^9}, {3.529405831894819*^9, 
   3.529405846520755*^9}, {3.529405889554759*^9, 3.529405891132985*^9}, {
   3.529406214615055*^9, 3.5294062352446747`*^9}, 3.529406687178342*^9, {
   3.5294068055185833`*^9, 3.529406816207178*^9}, 3.529586199265625*^9, {
   3.5295882234375*^9, 3.52958822803125*^9}, 3.529648042748663*^9, {
   3.529648106203412*^9, 3.529648262709896*^9}, 3.5296487639653587`*^9, 
   3.5296548394300013`*^9, {3.52965653791508*^9, 3.5296566203634562`*^9}, {
   3.529656651566328*^9, 3.529656721035078*^9}, {3.529656765097578*^9, 
   3.529656873316328*^9}, {3.5296666053718767`*^9, 3.529666666448438*^9}, {
   3.529666755495045*^9, 3.52966681544817*^9}, {3.52966687857317*^9, 
   3.52966694110442*^9}, {3.529667012557773*^9, 3.529667052729905*^9}, {
   3.529668444009518*^9, 3.529668456212331*^9}, {3.529668650035494*^9, 
   3.529668680612836*^9}, {3.529668946221074*^9, 3.529668948049199*^9}, 
   3.529668985064824*^9, 3.529772533515625*^9, {3.529772717234375*^9, 
   3.529772754890625*^9}, {3.529772890109375*^9, 3.52977289953125*^9}, {
   3.529772939171875*^9, 3.529772945140625*^9}, {3.529773730171875*^9, 
   3.529773742390625*^9}, {3.5305070886449814`*^9, 3.5305070898634815`*^9}, {
   3.5318214749420815`*^9, 3.531821534799924*^9}, {3.531821649282975*^9, 
   3.531821740954263*^9}, {3.531821872687886*^9, 3.531821906422477*^9}, {
   3.531822382878848*^9, 3.531822443066348*^9}, {3.531822584128848*^9, 
   3.531822586956973*^9}, {3.531822636926026*^9, 3.5318226583792877`*^9}, 
   3.531822721910945*^9, 3.5318227868488607`*^9, {3.5318228305210147`*^9, 
   3.5318228594118247`*^9}, {3.531822953365959*^9, 3.5318229545847244`*^9}, {
   3.531823021741834*^9, 3.531823029523184*^9}, {3.5318508063125*^9, 
   3.53185086296875*^9}, {3.53185094271875*^9, 3.53185095190625*^9}, {
   3.531851323546875*^9, 3.531851327234375*^9}, {3.5318513705625*^9, 
   3.53185140325*^9}, {3.531851745421875*^9, 3.531851776171875*^9}, 
   3.531851916953125*^9, 3.53185198565625*^9, {3.5318520355*^9, 
   3.531852055734375*^9}, {3.531852131125*^9, 3.53185242775*^9}, 
   3.5318524935*^9, {3.531852567671875*^9, 3.5318525968125*^9}, 
   3.5318526569375*^9, {3.53185271834375*^9, 3.531852730453125*^9}, {
   3.531852778046875*^9, 3.531852816578125*^9}, 3.5318528791875*^9, 
   3.5318529359375*^9, {3.531853121234375*^9, 3.53185313359375*^9}, {
   3.531853213296875*^9, 3.531853229109375*^9}, 3.53185334546875*^9, {
   3.53185339484375*^9, 3.531853415546875*^9}, {3.531853512078125*^9, 
   3.5318535208125*^9}, 3.5318536305*^9, {3.53185396240625*^9, 
   3.531853981984375*^9}, 3.531854122859375*^9, 3.531854238328125*^9, 
   3.531854277734375*^9, 3.53185432096875*^9, {3.53185446209375*^9, 
   3.531854465296875*^9}, {3.531854501703125*^9, 3.531854531859375*^9}, {
   3.531854672859375*^9, 3.531854677796875*^9}, 3.531854793046875*^9, {
   3.531854967640625*^9, 3.531854968703125*^9}, 3.53185686409375*^9, 
   3.531856929765625*^9, {3.531856961421875*^9, 3.5318569645*^9}, {
   3.53294350865112*^9, 3.5329435940404253`*^9}, 3.532943625768504*^9, {
   3.53294968451781*^9, 3.53294969926309*^9}, {3.5329498166326847`*^9, 
   3.532949826848361*^9}, {3.5347562519118595`*^9, 3.5347562538339562`*^9}, {
   3.535038519203125*^9, 3.535038582609375*^9}, 3.535038619890625*^9, {
   3.535038736046875*^9, 3.53503874728125*^9}, 3.535038781625*^9, {
   3.535052064671875*^9, 3.535052070078125*^9}, 3.535052148734375*^9, 
   3.53552612815625*^9, {3.53552654446875*^9, 3.5355265655*^9}, {
   3.535526655640625*^9, 3.535526667734375*^9}, {3.535540913890625*^9, 
   3.535540926203125*^9}, {3.535542077828125*^9, 3.535542164859375*^9}, 
   3.53560848015625*^9, {3.535627366375*^9, 3.53562739865625*^9}, 
   3.5357071089859867`*^9, {3.5357158589637623`*^9, 3.5357158620887423`*^9}, {
   3.5357159131037283`*^9, 3.5357159570250416`*^9}, 3.535716068244413*^9, {
   3.5357161094636908`*^9, 3.5357161132137384`*^9}, {3.5357746804327497`*^9, 
   3.5357746928700905`*^9}, {3.5357793232729306`*^9, 3.535779364643742*^9}, {
   3.537550440953125*^9, 3.53755044509375*^9}, {3.5381246334913673`*^9, 
   3.5381246337882442`*^9}, {3.5381247546171427`*^9, 
   3.5381247613671856`*^9}, {3.5381284995343723`*^9, 3.538128499925*^9}, {
   3.538128564581664*^9, 3.538128570034824*^9}, {3.5387209159563165`*^9, 
   3.5387209442370234`*^9}, {3.5387209925329714`*^9, 
   3.5387210164075127`*^9}, {3.538721067890899*^9, 3.5387210791250963`*^9}, {
   3.5387211841401696`*^9, 3.538721189249708*^9}, {3.5389771091289234`*^9, 
   3.5389771507536573`*^9}, {3.5389773706134157`*^9, 3.538977378629092*^9}, {
   3.538977436801339*^9, 3.538977449629546*^9}, {3.5389795324489436`*^9, 
   3.5389796080568666`*^9}, {3.54297259625*^9, 3.542972679515625*^9}, {
   3.542972715078125*^9, 3.5429727500625*^9}, {3.542972981015625*^9, 
   3.542972989625*^9}, 3.5429746984375*^9, {3.542974877109375*^9, 
   3.542974884875*^9}, {3.542974937703125*^9, 3.54297496146875*^9}, {
   3.542975018734375*^9, 3.542975022765625*^9}, {3.542975137140625*^9, 
   3.542975150203125*^9}, {3.54297525378125*^9, 3.542975271203125*^9}, {
   3.542975545015625*^9, 3.542975567875*^9}, {3.54297565515625*^9, 
   3.5429756736875*^9}, {3.54297595753125*^9, 3.54297595928125*^9}, {
   3.5429760023125*^9, 3.542976030203125*^9}, {3.54297606128125*^9, 
   3.54297612159375*^9}, {3.542976163828125*^9, 3.54297618125*^9}, {
   3.543308568890832*^9, 3.5433085836405487`*^9}, 3.54770801896875*^9, {
   3.5562750675148373`*^9, 3.5562751008266983`*^9}, {3.5562762595641165`*^9, 
   3.5562762845947256`*^9}, {3.55629212903125*^9, 3.556292199375*^9}, {
   3.561220342277252*^9, 3.5612203567774887`*^9}, {3.5680014737150745`*^9, 
   3.56800155225222*^9}, {3.568001589404505*^9, 3.568001644037182*^9}, {
   3.5680019343359504`*^9, 3.5680019351540327`*^9}, {3.5718603952525644`*^9, 
   3.5718604960755415`*^9}, {3.571860803396081*^9, 3.571860816936905*^9}, {
   3.57186088129823*^9, 3.5718611004630146`*^9}, {3.5718611437374907`*^9, 
   3.571861144704693*^9}, {3.5719023006394105`*^9, 3.5719023375802755`*^9}, {
   3.5719777969009705`*^9, 3.5719777971349735`*^9}, {3.572003746498443*^9, 
   3.572003812642867*^9}, {3.572160732707559*^9, 3.572160787742062*^9}, {
   3.57216083482977*^9, 3.5721608779750843`*^9}, {3.57216092953424*^9, 
   3.572160945168803*^9}, 3.572161070696355*^9, {3.5721614373920207`*^9, 
   3.572161442214503*^9}, {3.572168247653016*^9, 3.5721682874409947`*^9}, {
   3.5721740965098624`*^9, 3.5721740996541767`*^9}, {3.5721742270364256`*^9, 
   3.5721742276133676`*^9}, {3.5751809141066217`*^9, 3.575180987671978*^9}, {
   3.575616155735166*^9, 3.5756161608051662`*^9}, 3.575616192644766*^9, 
   3.5756162378311663`*^9, 3.5756171106820393`*^9, {3.5756171515816903`*^9, 
   3.5756171523867707`*^9}, {3.575617193753907*^9, 3.575617198113343*^9}, {
   3.575617236970228*^9, 3.57561724159169*^9}, {3.5756175065941877`*^9, 
   3.57561758942347*^9}, 3.5756177234118676`*^9, 3.575617761621688*^9, 
   3.5756178415306783`*^9, {3.5756178731018353`*^9, 3.575617920763601*^9}, {
   3.5756179509476185`*^9, 3.5756179520047245`*^9}, {3.575618161957718*^9, 
   3.575618177123234*^9}, 3.5756182552730484`*^9, {3.5756200346529827`*^9, 
   3.5756200715216694`*^9}, {3.5756201912826443`*^9, 3.5756202026957855`*^9}, 
   3.5756203755780716`*^9, 3.575620783174827*^9, {3.575626957796046*^9, 
   3.575626959874046*^9}, {3.57571609221749*^9, 3.575716095025508*^9}, {
   3.575738121981928*^9, 3.5757381228243294`*^9}, {3.5757383397772217`*^9, 
   3.575738359090056*^9}, {3.5768570336609335`*^9, 3.576857038473209*^9}, {
   3.5774504204680986`*^9, 3.5774504212021723`*^9}, {3.5779747360749087`*^9, 
   3.577974767007678*^9}, {3.5783783514473886`*^9, 3.5783784355107937`*^9}, {
   3.578385428846967*^9, 3.5783854311912446`*^9}, 3.578385469936412*^9, {
   3.578385565788417*^9, 3.5783855708925533`*^9}, 3.5783856118057513`*^9, {
   3.578395303191147*^9, 3.578395332781106*^9}, 3.5783966476225863`*^9, {
   3.5783967245402775`*^9, 3.578396730484872*^9}, {3.5783969073795595`*^9, 
   3.578396926359457*^9}, {3.5783969565154724`*^9, 3.5783969567064915`*^9}, {
   3.5785053959408913`*^9, 3.5785054219173765`*^9}, {3.57850547931966*^9, 
   3.578505483097876*^9}, {3.578505567671714*^9, 3.578505572348981*^9}, {
   3.578505648121315*^9, 3.5785056496824045`*^9}, {3.578806679021571*^9, 
   3.5788067242590947`*^9}, {3.5788069339590626`*^9, 3.578806978628529*^9}, {
   3.578807070220687*^9, 3.5788070873403993`*^9}, 3.578807186941358*^9, {
   3.57880735907657*^9, 3.578807368750537*^9}, {3.578807416141276*^9, 
   3.5788074307637377`*^9}, {3.5788076024259024`*^9, 3.578807610069667*^9}, {
   3.5788164470463667`*^9, 3.578816491488367*^9}, 3.5788165413783665`*^9, 
   3.581221660074452*^9, 3.5812236065910845`*^9, {3.590727131670643*^9, 
   3.5907271323097067`*^9}, {3.5907272320846834`*^9, 3.590727240275502*^9}, {
   3.590727273375812*^9, 3.590727309511425*^9}, {3.5907275820496764`*^9, 
   3.590727622477719*^9}, {3.590727813490818*^9, 3.590727817533222*^9}, {
   3.590727893667835*^9, 3.5907279023317013`*^9}, {3.5907279451399813`*^9, 
   3.5907279520696745`*^9}, {3.590728032910758*^9, 3.5907280832937956`*^9}, {
   3.590728243605135*^9, 3.590728274754135*^9}, {3.627647408661497*^9, 
   3.6276474160676465`*^9}, {3.632731261169592*^9, 3.6327312986997385`*^9}, 
   3.6327316998676844`*^9, {3.632731732682561*^9, 3.6327317362377644`*^9}, 
   3.6374728957175303`*^9, {3.6376407177439327`*^9, 3.63764073161932*^9}, {
   3.6376408105702143`*^9, 3.6376408198331404`*^9}, {3.637641341275279*^9, 
   3.637641437320883*^9}, 3.637641785319267*^9, {3.637641862500267*^9, 
   3.6376418678932667`*^9}, {3.63764211041119*^9, 3.637642132670416*^9}, {
   3.637642258078955*^9, 3.637642263887536*^9}, 3.6376424045666027`*^9, 
   3.637642482431388*^9, 3.637642692511394*^9, {3.6376435977649107`*^9, 
   3.6376436041405478`*^9}, 3.6376440947340565`*^9, 3.6376443160830564`*^9, {
   3.6379245652360525`*^9, 3.6379245863731656`*^9}, {3.6379249435768824`*^9, 
   3.6379249796974945`*^9}, {3.6379251425457773`*^9, 3.6379252366191835`*^9}, 
   3.6379252749810195`*^9, 3.6515700018452187`*^9, {3.651570152785311*^9, 
   3.6515701899700294`*^9}, {3.6515702206150937`*^9, 
   3.6515702482648582`*^9}, {3.651570387334764*^9, 3.651570398182849*^9}, {
   3.6515705301070395`*^9, 3.651570554889518*^9}, 3.651572007519766*^9, {
   3.6515721157125845`*^9, 3.6515721176267757`*^9}, 3.651572468174827*^9, {
   3.651572507225732*^9, 3.651572509906*^9}, {3.651572684279435*^9, 
   3.6515726857305803`*^9}, 3.651572784904497*^9}]
}, Open  ]],

Cell[CellGroupData[{

Cell[BoxData["Dump"], "Subsection"],

Cell[CellGroupData[{

Cell[BoxData[
 RowBox[{"DumpSave", "[", 
  RowBox[{
  "\"\<C:\\\\Hopsan\\\\Compgen\\\\CompgenNG.mx\>\"", ",", "\"\<Global`\>\""}],
   "]"}]], "Input",
 CellChangeTimes->{{3.5039001061983414`*^9, 3.503900119120216*^9}, {
   3.503900191307716*^9, 3.503900192151466*^9}, 3.51832982048666*^9, 
   3.57691974673184*^9, {3.6114743065641418`*^9, 3.6114743068441696`*^9}}],

Cell[BoxData[
 RowBox[{"{", "\<\"Global`\"\>", "}"}]], "Output",
 CellChangeTimes->{{3.503900124713966*^9, 3.503900153057716*^9}, 
   3.5039018039452744`*^9, 3.5039022995610113`*^9, 3.503904660578999*^9, {
   3.503905385885704*^9, 3.5039053991512337`*^9}, {3.503910471040206*^9, 
   3.503910479993388*^9}, 3.503912937472966*^9, 3.503913170362203*^9, 
   3.50391420058603*^9, 3.503914377081791*^9, {3.50391532670323*^9, 
   3.503915335125105*^9}, 3.5039218217831135`*^9, 3.5039219320011578`*^9, 
   3.5039220499691525`*^9, 3.503942416265625*^9, 3.503943914140625*^9, 
   3.50399560340646*^9, 3.5039977454032483`*^9, 3.504103992140625*^9, 
   3.504104799421875*^9, 3.50410486371875*^9, 3.50412025484375*^9, 
   3.5041215949375*^9, 3.504160056296875*^9, 3.504162351125*^9, 
   3.504194471234375*^9, 3.5041982440625*^9, 3.504262856141876*^9, 
   3.50427132107969*^9, 3.505554962053999*^9, 3.5055894060625*^9, 
   3.505590182390625*^9, 3.50559045615625*^9, 3.505590652828125*^9, 
   3.5058137025722413`*^9, 3.5058138172395973`*^9, 3.505814154334297*^9, 
   3.505820463711565*^9, 3.5058226233476324`*^9, 3.505822875795127*^9, 
   3.50597718346875*^9, 3.50597909809375*^9, 3.506006497625*^9, 
   3.507794070859375*^9, 3.50779434278125*^9, 3.5077945251875*^9, 
   3.50779457115625*^9, 3.507795503375*^9, 3.5077957820625*^9, 
   3.5077961455*^9, 3.5109092059269485`*^9, 3.511376968*^9, 
   3.511510459587935*^9, 3.51151735594033*^9, 3.5118610652384963`*^9, 
   3.5121849165923405`*^9, 3.512792518183462*^9, 3.512818247595663*^9, 
   3.51283218296875*^9, 3.512832753171875*^9, 3.51292169721875*^9, 
   3.5130705374628344`*^9, 3.5130740477980824`*^9, 3.51310076821875*^9, 
   3.513232794*^9, {3.51323549646875*^9, 3.51323550075*^9}, 3.51323555925*^9, 
   3.513266466609375*^9, 3.5133128167314987`*^9, 3.513316496622219*^9, 
   3.513320919720274*^9, 3.513321012377117*^9, 3.513321392825066*^9, 
   3.513333085167547*^9, 3.51333552753762*^9, 3.513354149453125*^9, 
   3.5133953517477174`*^9, 3.513936767704514*^9, 3.513936949517014*^9, 
   3.513937047735764*^9, 3.5139387158459682`*^9, 3.5154964262067113`*^9, 
   3.515610958328125*^9, 3.51561219440625*^9, 3.515612927640625*^9, 
   3.5156133999375*^9, 3.515613490109375*^9, 3.5156136326875*^9, 
   3.51561378053125*^9, 3.5156138131875*^9, 3.515613877125*^9, 
   3.515613919515625*^9, 3.51567645265625*^9, 3.515677039625*^9, 
   3.51567742071875*^9, 3.515677797515625*^9, 3.51568201809375*^9, 
   3.515682063421875*^9, 3.515682459828125*^9, 3.515682509625*^9, 
   3.515685932734375*^9, 3.515686052734375*^9, 3.51568645346875*^9, 
   3.515686533*^9, 3.515726173151297*^9, 3.515726301418527*^9, 
   3.515727602603569*^9, 3.5157276621809316`*^9, 3.5157313158651247`*^9, 
   3.515735223791819*^9, 3.5157353646184573`*^9, 3.5157353981494927`*^9, 
   3.5157529918565564`*^9, 3.51575322177884*^9, 3.5157547697386465`*^9, 
   3.5158217750008106`*^9, 3.5158220732474813`*^9, 3.51582224227765*^9, 
   3.51582277819891*^9, 3.5158230416659737`*^9, 3.515823204149309*^9, 
   3.5159006501892347`*^9, 3.51603013028125*^9, 3.516032137203125*^9, 
   3.51603273590625*^9, 3.516032980015625*^9, 3.516087353125*^9, 
   3.516089131234375*^9, 3.51608933321875*^9, 3.516089373609375*^9, 
   3.516089441703125*^9, 3.516111146046875*^9, 3.5166877473841324`*^9, 
   3.5166878798068547`*^9, 3.51668801110497*^9, 3.5166881313877597`*^9, 
   3.5166881839509325`*^9, 3.5166882381391263`*^9, 3.516688493903472*^9, 
   3.5166887686967416`*^9, 3.516688895931117*^9, 3.516688984899887*^9, 
   3.5166890164313393`*^9, 3.516698399599833*^9, 3.516699532888763*^9, 
   3.516705807207638*^9, 3.516716995609375*^9, 3.516717072984375*^9, 
   3.5168188448125*^9, 3.516818911609375*^9, 3.5168194339375*^9, 
   3.5168530620625*^9, 3.51685970215625*^9, 3.51685990321875*^9, 
   3.5168605738125*^9, 3.516860612171875*^9, 3.51686068584375*^9, 
   3.516860785015625*^9, 3.516861031234375*^9, 3.5168611261875*^9, 
   3.51686225025*^9, 3.516863487953125*^9, 3.516866140375*^9, 
   3.517049569462682*^9, 3.517286729991625*^9, 3.5175494927935667`*^9, 
   3.5175711332700872`*^9, 3.517571236036714*^9, 3.5176265485289125`*^9, 
   3.517630767769555*^9, 3.51763109176688*^9, 3.5176311630716214`*^9, 
   3.5176435759173064`*^9, 3.517643790215553*^9, 3.5176438537472095`*^9, 
   3.51764409183801*^9, 3.517644153446596*^9, 3.5176442128670187`*^9, 
   3.517644262303253*^9, 3.51825340659375*^9, 3.518253671703125*^9, 
   3.51832982342416*^9, 3.51854700846875*^9, 3.518547211046875*^9, 
   3.518547553328125*^9, 3.5185476654375*^9, 3.518613182375*^9, {
   3.518613704203125*^9, 3.518613729546875*^9}, 3.51861389484375*^9, 
   3.518627117921875*^9, 3.51862730671875*^9, 3.518627399734375*^9, 
   3.518627458828125*^9, 3.518627563875*^9, {3.518627710921875*^9, 
   3.51862773990625*^9}, 3.518627896484375*^9, 3.518627931875*^9, 
   3.51863025115625*^9, 3.51863047946875*^9, 3.518630683796875*^9, 
   3.51863077746875*^9, 3.51863104809375*^9, 3.518631129390625*^9, 
   3.518636306890625*^9, 3.518636511*^9, 3.518676248703125*^9, 
   3.51867719971875*^9, 3.518677241921875*^9, 3.51867759628125*^9, 
   3.51868042134375*^9, 3.518680607375*^9, 3.51868070278125*^9, 
   3.518790562140625*^9, 3.5187916254375*^9, 3.518791881296875*^9, 
   3.5187920715625*^9, 3.518792831859375*^9, 3.518795758359375*^9, 
   3.51879617628125*^9, 3.51879901340625*^9, 3.518841937444518*^9, 
   3.5188432377230577`*^9, 3.518844270160618*^9, 3.51901693047921*^9, 
   3.519063555515625*^9, 3.519149168234375*^9, 3.519153207796875*^9, 
   3.519154128890625*^9, 3.519154796828125*^9, 3.519154985*^9, 
   3.51919397540625*^9, 3.519194278046875*^9, 3.5191943484375*^9, 
   3.519201755125*^9, 3.519233504390625*^9, 3.519237363671875*^9, 
   3.5192376600625*^9, 3.51923775559375*^9, 3.519238673390625*^9, 
   3.519238731734375*^9, 3.519317901796875*^9, 3.519318125453125*^9, 
   3.519318290546875*^9, 3.51940388034375*^9, 3.51940417590625*^9, 
   3.519442215984375*^9, 3.51944260278125*^9, 3.519442790765625*^9, 
   3.5194436289375*^9, 3.519443730859375*^9, 3.51953790540625*^9, 
   3.519805567796875*^9, 3.51980593396875*^9, 3.519813953296875*^9, 
   3.519905596625*^9, 3.520834681546875*^9, 3.52156945859375*^9, 
   3.521709181*^9, 3.521777876875*^9, 3.52191331353125*^9, 
   3.521967993265625*^9, 3.521970537359375*^9, 3.522517671765625*^9, 
   3.52251791071875*^9, 3.522517990421875*^9, 3.52251810371875*^9, 
   3.522518950625*^9, 3.5225631425440135`*^9, {3.5225632574815693`*^9, 
   3.52256326171589*^9}, 3.5225633185901623`*^9, 3.5226018029375*^9, 
   3.522636789028678*^9, {3.5226377196035285`*^9, 3.522637721853701*^9}, 
   3.5226507428125*^9, 3.5248192524281235`*^9, 3.529404210705599*^9, 
   3.529587540984375*^9, 3.5296483043857713`*^9, 3.5296487686676707`*^9, 
   3.52966668013567*^9, 3.529667102823976*^9, 3.5296675279177914`*^9, 
   3.5296683809938173`*^9, 3.529668460196604*^9, 3.5296687171744003`*^9, 
   3.529668954877324*^9, 3.529669067315366*^9, 3.529772788015625*^9, 
   3.52977294865625*^9, 3.5318221761586456`*^9, 3.5318225906913548`*^9, 
   3.5318228743337955`*^9, 3.531822957178508*^9, 3.531823035554511*^9, 
   3.53185086684375*^9, 3.531850965*^9, 3.531851331203125*^9, 
   3.531851419140625*^9, 3.531851785609375*^9, 3.531852004671875*^9, 
   3.53185231825*^9, 3.5318524333125*^9, {3.5318524729375*^9, 3.531852498*^9},
    3.531852600609375*^9, 3.5318526638125*^9, 3.531852736765625*^9, 
   3.531852793859375*^9, 3.5318528253125*^9, 3.531852882453125*^9, 
   3.53185294675*^9, 3.531853083984375*^9, 3.5318531369375*^9, 
   3.53185327503125*^9, 3.531853350015625*^9, {3.5318534024375*^9, 
   3.531853418390625*^9}, 3.531853469859375*^9, {3.531853524078125*^9, 
   3.53185352684375*^9}, 3.531853641515625*^9, 3.5318537570625*^9, 
   3.531853986359375*^9, {3.531854125953125*^9, 3.531854154625*^9}, 
   3.531854241953125*^9, 3.531854281109375*^9, 3.531854366796875*^9, 
   3.531854474234375*^9, 3.53185453775*^9, 3.531855025734375*^9, 
   3.531856870625*^9, 3.531856938015625*^9, 3.531856973203125*^9, {
   3.5329497274571905`*^9, 3.53294975080909*^9}, 3.5350455973125*^9, 
   3.535526147*^9, 3.535526578453125*^9, 3.535526673921875*^9, 
   3.535541080703125*^9, 3.53554245584375*^9, 3.53555588728125*^9, 
   3.535575940359375*^9, 3.5356084863125*^9, 3.5357161211200895`*^9, 
   3.535717921003477*^9, 3.535718041564534*^9, 3.53577470001035*^9, 
   3.53755046296875*^9, 3.538038896*^9, 3.5381247926017604`*^9, 
   3.538128510706319*^9, {3.538721201937614*^9, 3.5387212152661657`*^9}, 
   3.538977217503491*^9, 3.538977386113515*^9, {3.538977453598322*^9, 
   3.5389774577077227`*^9}, 3.5389775232550173`*^9, 3.538987498191622*^9, 
   3.542972767*^9, 3.54297301853125*^9, 3.542974518078125*^9, 
   3.542974893078125*^9, 3.5429749675*^9, 3.542975285578125*^9, 
   3.542976186921875*^9, 3.543308602421438*^9, 3.5562764373095665`*^9, 
   3.5608525077900085`*^9, 3.5680013831661305`*^9, 3.568001729903509*^9, 
   3.56845482772659*^9, 3.568521055262762*^9, 3.568526259390439*^9, 
   3.5718611488387*^9, 3.5719139371970043`*^9, 3.5719770068242564`*^9, 
   3.571977811206354*^9, 3.572003823656538*^9, 3.572161149429227*^9, 
   3.5721614514244237`*^9, 3.572174033529565*^9, 3.572174105117723*^9, 
   3.572174231289*^9, 3.575616056349966*^9, 3.575616196263966*^9, 
   3.575616240420766*^9, 3.575617156601192*^9, 3.575617244456977*^9, {
   3.5756176800085278`*^9, 3.5756177257180977`*^9}, 3.5756177644649725`*^9, {
   3.5756179292294474`*^9, 3.5756179590294266`*^9}, 3.575618180853607*^9, 
   3.575618257927314*^9, 3.5756184245229716`*^9, 3.57562008333285*^9, 
   3.5756202337338886`*^9, 3.575620379050419*^9, 3.5756204400855217`*^9, 
   3.5756214179512987`*^9, 3.5756226205795493`*^9, 3.575622667849276*^9, 
   3.5756270952400455`*^9, 3.5757159361417913`*^9, 3.575737875254572*^9, 
   3.5757381756900215`*^9, 3.5765152706483746`*^9, 3.576920014896654*^9, 
   3.577450470148066*^9, 3.577974774187089*^9, 3.5783854887687407`*^9, 
   3.5783856150953503`*^9, 3.578395613461171*^9, 3.5783967407679*^9, {
   3.5783969332021413`*^9, 3.5783969615169725`*^9}, {3.5785051471906633`*^9, 
   3.5785051510728855`*^9}, 3.578505434608103*^9, 3.578505488448182*^9, 
   3.5785055864937897`*^9, 3.5785056543116693`*^9, 3.5788065088175526`*^9, 
   3.5788067295276213`*^9, 3.5788070929969645`*^9, 3.5788071906147256`*^9, 
   3.5788074341260743`*^9, 3.5788076137360334`*^9, 3.5788163099113665`*^9, 
   3.578816494642367*^9, 3.5792831826203585`*^9, 3.581236844800953*^9, 
   3.5812373347382565`*^9, {3.5907270023997173`*^9, 3.590727014207898*^9}, {
   3.5907271371191874`*^9, 3.590727149175393*^9}, 3.590727250418516*^9, 
   3.5907272819936733`*^9, 3.590727633111782*^9, 3.5907279187763453`*^9, 
   3.590727961854653*^9, 3.5907280671591825`*^9, 3.590728118260292*^9, 
   3.590728252554135*^9, 3.5907282856301346`*^9, 3.611467543821784*^9, 
   3.6114742108435707`*^9, 3.6114743141318984`*^9, 3.6114746791033916`*^9, 
   3.6114747508215632`*^9, 3.6327313500466757`*^9, 3.632731618061005*^9, 
   3.6327316481277246`*^9, 3.6327317109053154`*^9, 3.6327317493835163`*^9, 
   3.637472919120999*^9, 3.637641447476898*^9, 3.6376416571238613`*^9, 
   3.6376417923662667`*^9, 3.637641871134267*^9, 3.6376421415293016`*^9, 
   3.637642456306776*^9, 3.6376424865047956`*^9, {3.637642732661409*^9, 
   3.6376427734924917`*^9}, 3.637643480407176*^9, 3.6376436169388275`*^9, 
   3.637643676398773*^9, {3.6376437339440565`*^9, 3.637643761745057*^9}, 
   3.637644026917057*^9, 3.6376443262650566`*^9, 3.637645666340666*^9, 
   3.6379253098115025`*^9, 3.6379257615054865`*^9, 3.651561973726468*^9, 
   3.6515698880678425`*^9, 3.651570252692301*^9, 3.651570403735404*^9, 
   3.651570558134842*^9, 3.651572214239436*^9, 3.6515724726742773`*^9, 
   3.6515725135103602`*^9, 3.651572795870593*^9, 3.651572851180124*^9, 
   3.6641832762231145`*^9, 3.664183334025384*^9}]
}, Open  ]]
}, Open  ]]
}, Open  ]]
},
WindowSize->{1008, 669},
WindowMargins->{{0, Automatic}, {Automatic, 0}},
FrontEndVersion->"10.3 for Microsoft Windows (64-bit) (October 9, 2015)",
StyleDefinitions->FrontEnd`FileName[{"Creative"}, "PastelColor.nb", 
  CharacterEncoding -> "WindowsANSI"]
]
(* End of Notebook Content *)

(* Internal cache information *)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[CellGroupData[{
Cell[567, 22, 93, 1, 65, "Title"],
Cell[663, 25, 184, 4, 30, "Text"],
Cell[CellGroupData[{
Cell[872, 33, 95, 1, 36, "Subsection"],
Cell[970, 36, 183, 5, 49, "Text"]
}, Open  ]],
Cell[CellGroupData[{
Cell[1190, 46, 103, 1, 36, "Subsection"],
Cell[1296, 49, 2385, 52, 162, "Input"],
Cell[3684, 103, 2665, 56, 162, "Input"],
Cell[6352, 161, 2322, 51, 162, "Input"],
Cell[8677, 214, 2291, 50, 162, "Input"],
Cell[10971, 266, 2222, 49, 162, "Input"],
Cell[13196, 317, 2080, 48, 162, "Input"],
Cell[15279, 367, 1849, 44, 162, "Input"],
Cell[17131, 413, 2432, 53, 162, "Input"],
Cell[19566, 468, 2647, 56, 162, "Input"],
Cell[22216, 526, 1729, 39, 122, "Input"],
Cell[23948, 567, 1665, 38, 122, "Input"],
Cell[25616, 607, 1885, 33, 62, "Input"],
Cell[27504, 642, 1994, 35, 62, "Input"],
Cell[29501, 679, 904, 19, 262, "Input"]
}, Open  ]],
Cell[CellGroupData[{
Cell[30442, 703, 163, 2, 36, "Subsection"],
Cell[30608, 707, 2486, 54, 162, "Input"],
Cell[33097, 763, 2766, 58, 162, "Input"],
Cell[35866, 823, 2416, 52, 162, "Input"],
Cell[38285, 877, 2322, 51, 162, "Input"],
Cell[40610, 930, 2181, 50, 162, "Input"],
Cell[42794, 982, 1950, 46, 162, "Input"],
Cell[44747, 1030, 2515, 55, 162, "Input"],
Cell[47265, 1087, 2732, 58, 162, "Input"],
Cell[50000, 1147, 1824, 40, 122, "Input"],
Cell[51827, 1189, 1760, 39, 122, "Input"],
Cell[53590, 1230, 2025, 37, 62, "Input"],
Cell[55618, 1269, 2132, 38, 62, "Input"],
Cell[57753, 1309, 904, 19, 262, "Input"],
Cell[58660, 1330, 291, 7, 41, "Input"]
}, Open  ]],
Cell[58966, 1340, 126, 1, 36, "Subsection"],
Cell[CellGroupData[{
Cell[59117, 1345, 41, 0, 28, "Subsection"],
Cell[59161, 1347, 126, 3, 28, "SmallText"],
Cell[59290, 1352, 281, 11, 194, "Input"],
Cell[59574, 1365, 3700, 97, 322, "Input"],
Cell[63277, 1464, 90, 1, 41, "Input"],
Cell[63370, 1467, 3033, 49, 522, "Input"]
}, Open  ]],
Cell[CellGroupData[{
Cell[66440, 1521, 110, 1, 36, "Subsection"],
Cell[66553, 1524, 3241, 67, 262, "Input"],
Cell[69797, 1593, 3434, 70, 262, "Input"],
Cell[73234, 1665, 521, 11, 41, "Input"],
Cell[73758, 1678, 1753, 40, 142, "Input"],
Cell[75514, 1720, 2319, 51, 182, "Input"]
}, Open  ]],
Cell[CellGroupData[{
Cell[77870, 1776, 155, 2, 36, "Subsection"],
Cell[78028, 1780, 199415, 4375, 19429, "Input"]
}, Open  ]],
Cell[CellGroupData[{
Cell[277480, 6160, 35, 0, 37, "Subsection"],
Cell[CellGroupData[{
Cell[277540, 6164, 364, 7, 41, "Input"],
Cell[277907, 6173, 11776, 168, 41, "Output"]
}, Open  ]]
}, Open  ]]
}, Open  ]]
}
]
*)

(* End of internal cache information *)
